@chill-sharp/ui-core 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/chillsharp-current-user-preferences/SKILL.md +70 -0
- package/.agents/skills/chillsharp-ui-template/SKILL.md +18 -0
- package/README.md +103 -0
- package/chill-sharp-ui-core.d.ts.map +1 -0
- package/doc/AIAssistedDevelopment/README.md +185 -0
- package/doc/AttachmentModel/README.md +173 -0
- package/doc/AuthenticationModel/README.md +213 -0
- package/doc/AuthenticationModel/how-to-integreate-auth-minimal-api.md +293 -0
- package/doc/ChillSharpClient.md +464 -0
- package/doc/ClientGeneration/README.md +172 -0
- package/doc/ComplianceGuide/README.md +178 -0
- package/doc/Configuration/README.md +94 -0
- package/doc/CurrentUserPreferences.md +114 -0
- package/doc/DateTimePolicy/README.md +154 -0
- package/doc/DateTimeSerialization.md +423 -0
- package/doc/Endpoints.md +260 -0
- package/doc/HowTo/01-simple-blog-sqlite.md +153 -0
- package/doc/HowTo/02-blog-schema-labels.md +140 -0
- package/doc/HowTo/03-authentication.md +218 -0
- package/doc/HowTo/04-blog-posts-one-to-many.md +194 -0
- package/doc/HowTo/05-docker-env-variables.md +274 -0
- package/doc/HowTo/06-chunk-transactions-autocomplete.md +196 -0
- package/doc/Mcp/ChatGPT.md +291 -0
- package/doc/Mcp/README.md +799 -0
- package/doc/MenuGuide/README.md +49 -0
- package/doc/ModelPreparation.md +255 -0
- package/doc/PermissionModel/README.md +277 -0
- package/doc/README.md +228 -0
- package/doc/ReferenceExistence.md +130 -0
- package/doc/RegisterContext.md +217 -0
- package/doc/UiCore/CRUD.md +170 -0
- package/doc/UiCore/README.md +13 -0
- package/doc/ValidationModel/README.md +117 -0
- package/doc/it/AIAssistedDevelopment/README.md +185 -0
- package/doc/it/AttachmentModel/README.md +173 -0
- package/doc/it/AuthenticationModel/README.md +171 -0
- package/doc/it/AuthenticationModel/how-to-integreate-auth-minimal-api.md +292 -0
- package/doc/it/ChillSharpClient.md +464 -0
- package/doc/it/ClientGeneration/README.md +152 -0
- package/doc/it/ComplianceGuide/README.md +178 -0
- package/doc/it/Configuration/README.md +94 -0
- package/doc/it/CurrentUserPreferences.md +114 -0
- package/doc/it/DateTimePolicy/README.md +154 -0
- package/doc/it/DateTimeSerialization.md +423 -0
- package/doc/it/Endpoints.md +260 -0
- package/doc/it/HowTo/01-simple-blog-sqlite.md +152 -0
- package/doc/it/HowTo/02-blog-schema-labels.md +139 -0
- package/doc/it/HowTo/03-authentication.md +221 -0
- package/doc/it/HowTo/04-blog-posts-one-to-many.md +193 -0
- package/doc/it/HowTo/05-docker-env-variables.md +268 -0
- package/doc/it/HowTo/06-chunk-transactions-autocomplete.md +196 -0
- package/doc/it/Mcp/ChatGPT.md +291 -0
- package/doc/it/Mcp/README.md +799 -0
- package/doc/it/MenuGuide/README.md +49 -0
- package/doc/it/ModelPreparation.md +254 -0
- package/doc/it/PermissionModel/README.md +190 -0
- package/doc/it/README.md +172 -0
- package/doc/it/ReferenceExistence.md +130 -0
- package/doc/it/RegisterContext.md +218 -0
- package/doc/it/UiCore/CRUD.md +170 -0
- package/doc/it/UiCore/README.md +13 -0
- package/doc/it/ValidationModel/README.md +117 -0
- package/fesm2022/chill-sharp-ui-core.mjs +16725 -0
- package/fesm2022/chill-sharp-ui-core.mjs.map +1 -0
- package/index.d.ts +6 -0
- package/lib/chill-sharp-ui-root.component.d.ts +6 -0
- package/lib/chill-sharp-ui-root.component.d.ts.map +1 -0
- package/lib/chill-sharp-ui.routes.d.ts +3 -0
- package/lib/chill-sharp-ui.routes.d.ts.map +1 -0
- package/lib/chill.config.d.ts +5 -0
- package/lib/chill.config.d.ts.map +1 -0
- package/lib/layouts/auth-shell.component.d.ts +8 -0
- package/lib/layouts/auth-shell.component.d.ts.map +1 -0
- package/lib/layouts/workspace-page.component.d.ts +49 -0
- package/lib/layouts/workspace-page.component.d.ts.map +1 -0
- package/lib/lib/chill-form.component.d.ts +151 -0
- package/lib/lib/chill-form.component.d.ts.map +1 -0
- package/lib/lib/chill-i18n-button-label.component.d.ts +27 -0
- package/lib/lib/chill-i18n-button-label.component.d.ts.map +1 -0
- package/lib/lib/chill-i18n-label.component.d.ts +30 -0
- package/lib/lib/chill-i18n-label.component.d.ts.map +1 -0
- package/lib/lib/chill-json-input.component.d.ts +31 -0
- package/lib/lib/chill-json-input.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-boolean-control.component.d.ts +12 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-boolean-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-editor-control.component.d.ts +17 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-editor-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-lookup-control.component.d.ts +45 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-lookup-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-scalar-control.component.d.ts +19 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-scalar-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-select-control.component.d.ts +12 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-select-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-textarea-control.component.d.ts +13 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-textarea-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-input.component.d.ts +452 -0
- package/lib/lib/chill-polymorphic-input.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-boolean-control.component.d.ts +7 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-boolean-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-lookup-control.component.d.ts +7 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-lookup-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-number-control.component.d.ts +7 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-number-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-temporal-control.component.d.ts +8 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-temporal-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-value-control.component.d.ts +7 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-value-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-output.component.d.ts +75 -0
- package/lib/lib/chill-polymorphic-output.component.d.ts.map +1 -0
- package/lib/lib/chill-table.component.d.ts +434 -0
- package/lib/lib/chill-table.component.d.ts.map +1 -0
- package/lib/lib/chill-text-editor-dialog.component.d.ts +14 -0
- package/lib/lib/chill-text-editor-dialog.component.d.ts.map +1 -0
- package/lib/lib/crud-configuration.utils.d.ts +4 -0
- package/lib/lib/crud-configuration.utils.d.ts.map +1 -0
- package/lib/lib/culture-name-options.d.ts +3 -0
- package/lib/lib/culture-name-options.d.ts.map +1 -0
- package/lib/lib/date-format-options.d.ts +3 -0
- package/lib/lib/date-format-options.d.ts.map +1 -0
- package/lib/lib/iana-time-zone-options.d.ts +3 -0
- package/lib/lib/iana-time-zone-options.d.ts.map +1 -0
- package/lib/lib/notice-transition.directive.d.ts +17 -0
- package/lib/lib/notice-transition.directive.d.ts.map +1 -0
- package/lib/lib/schema-property-dialog.component.d.ts +74 -0
- package/lib/lib/schema-property-dialog.component.d.ts.map +1 -0
- package/lib/models/chill-auth.models.d.ts +176 -0
- package/lib/models/chill-auth.models.d.ts.map +1 -0
- package/lib/models/chill-menu.models.d.ts +12 -0
- package/lib/models/chill-menu.models.d.ts.map +1 -0
- package/lib/models/chill-schema.models.d.ts +141 -0
- package/lib/models/chill-schema.models.d.ts.map +1 -0
- package/lib/models/workspace-dialog.models.d.ts +16 -0
- package/lib/models/workspace-dialog.models.d.ts.map +1 -0
- package/lib/models/workspace-task.models.d.ts +36 -0
- package/lib/models/workspace-task.models.d.ts.map +1 -0
- package/lib/pages/confirm-reset-page.component.d.ts +21 -0
- package/lib/pages/confirm-reset-page.component.d.ts.map +1 -0
- package/lib/pages/crud/attachment-upload-dialog.component.d.ts +24 -0
- package/lib/pages/crud/attachment-upload-dialog.component.d.ts.map +1 -0
- package/lib/pages/crud/crud-page.component.d.ts +244 -0
- package/lib/pages/crud/crud-page.component.d.ts.map +1 -0
- package/lib/pages/login-page.component.d.ts +21 -0
- package/lib/pages/login-page.component.d.ts.map +1 -0
- package/lib/pages/permissions/auth-role-dialog.component.d.ts +29 -0
- package/lib/pages/permissions/auth-role-dialog.component.d.ts.map +1 -0
- package/lib/pages/permissions/auth-search-select.component.d.ts +28 -0
- package/lib/pages/permissions/auth-search-select.component.d.ts.map +1 -0
- package/lib/pages/permissions/auth-user-dialog.component.d.ts +35 -0
- package/lib/pages/permissions/auth-user-dialog.component.d.ts.map +1 -0
- package/lib/pages/permissions/permission-editor.component.d.ts +55 -0
- package/lib/pages/permissions/permission-editor.component.d.ts.map +1 -0
- package/lib/pages/permissions/permissions-page.component.d.ts +38 -0
- package/lib/pages/permissions/permissions-page.component.d.ts.map +1 -0
- package/lib/pages/permissions/role-permission.component.d.ts +43 -0
- package/lib/pages/permissions/role-permission.component.d.ts.map +1 -0
- package/lib/pages/permissions/user-permission.component.d.ts +43 -0
- package/lib/pages/permissions/user-permission.component.d.ts.map +1 -0
- package/lib/pages/register-page.component.d.ts +24 -0
- package/lib/pages/register-page.component.d.ts.map +1 -0
- package/lib/pages/reset-password-page.component.d.ts +18 -0
- package/lib/pages/reset-password-page.component.d.ts.map +1 -0
- package/lib/provide-chill-sharp-ui-core.d.ts +8 -0
- package/lib/provide-chill-sharp-ui-core.d.ts.map +1 -0
- package/lib/services/chill.service.d.ts +249 -0
- package/lib/services/chill.service.d.ts.map +1 -0
- package/lib/services/workspace-dialog.service.d.ts +22 -0
- package/lib/services/workspace-dialog.service.d.ts.map +1 -0
- package/lib/services/workspace-layout.service.d.ts +13 -0
- package/lib/services/workspace-layout.service.d.ts.map +1 -0
- package/lib/services/workspace-task-registry.service.d.ts +35 -0
- package/lib/services/workspace-task-registry.service.d.ts.map +1 -0
- package/lib/services/workspace-toolbar.service.d.ts +23 -0
- package/lib/services/workspace-toolbar.service.d.ts.map +1 -0
- package/lib/services/workspace.service.d.ts +114 -0
- package/lib/services/workspace.service.d.ts.map +1 -0
- package/lib/storage-keys.d.ts +5 -0
- package/lib/storage-keys.d.ts.map +1 -0
- package/lib/tasks/crud-task/crud-task.component.d.ts +33 -0
- package/lib/tasks/crud-task/crud-task.component.d.ts.map +1 -0
- package/lib/tasks/goto-url-task/goto-url-task.component.d.ts +31 -0
- package/lib/tasks/goto-url-task/goto-url-task.component.d.ts.map +1 -0
- package/lib/workspace/confirm-message-dialog.component.d.ts +16 -0
- package/lib/workspace/confirm-message-dialog.component.d.ts.map +1 -0
- package/lib/workspace/entity-options-dialog.component.d.ts +29 -0
- package/lib/workspace/entity-options-dialog.component.d.ts.map +1 -0
- package/lib/workspace/external-task-api.d.ts +2 -0
- package/lib/workspace/external-task-api.d.ts.map +1 -0
- package/lib/workspace/user-profile-dialog.component.d.ts +30 -0
- package/lib/workspace/user-profile-dialog.component.d.ts.map +1 -0
- package/lib/workspace/workspace-dialog-host.component.d.ts +26 -0
- package/lib/workspace/workspace-dialog-host.component.d.ts.map +1 -0
- package/lib/workspace/workspace-menu-item-dialog.component.d.ts +61 -0
- package/lib/workspace/workspace-menu-item-dialog.component.d.ts.map +1 -0
- package/lib/workspace/workspace-menu.component.d.ts +104 -0
- package/lib/workspace/workspace-menu.component.d.ts.map +1 -0
- package/lib/workspace/workspace-taskbar.component.d.ts +14 -0
- package/lib/workspace/workspace-taskbar.component.d.ts.map +1 -0
- package/package.json +54 -0
- package/public-api.d.ts +56 -0
- package/public-api.d.ts.map +1 -0
- package/service-worker/chill-sharp-service-worker.js +166 -0
- package/styles/core-theme.scss +1268 -0
- package/template-customization/upgrade.ps1.template +342 -0
- package/template-customization/upgrade.sh.template +271 -0
package/doc/README.md
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# ChillSharp Documentation
|
|
2
|
+
|
|
3
|
+
Versione italiana: [Italiano](./it/README.md)
|
|
4
|
+
|
|
5
|
+
This folder contains the reference documentation for ChillSharp.
|
|
6
|
+
|
|
7
|
+
`doc/HowTo` is intentionally left as the tutorial section. Use it for guided, incremental examples. The rest of this folder is the reference layer: concepts, registration, permissions, auth, and client-generation workflows.
|
|
8
|
+
|
|
9
|
+
## Documentation Map
|
|
10
|
+
|
|
11
|
+
- [ModelPreparation.md](./ModelPreparation.md)
|
|
12
|
+
Prepare an EF Core model so ChillSharp can activate entities, run lifecycle hooks, generate schema metadata, and persist audit fields.
|
|
13
|
+
|
|
14
|
+
- [ReferenceExistence.md](./ReferenceExistence.md)
|
|
15
|
+
Check whether an EF Core reference has foreign-key values without loading its related entity, including databases without enforced FK constraints.
|
|
16
|
+
|
|
17
|
+
- [RegisterContext.md](./RegisterContext.md)
|
|
18
|
+
Register ChillSharp modules against a host `DbContext` and map the API surface.
|
|
19
|
+
|
|
20
|
+
- [Configuration/README.md](./Configuration/README.md)
|
|
21
|
+
Quick reference for the example host configuration options and their environment variables.
|
|
22
|
+
|
|
23
|
+
- [AttachmentModel/README.md](./AttachmentModel/README.md)
|
|
24
|
+
Attachment entity model, archive layout, configuration, and upload/download endpoint behavior.
|
|
25
|
+
|
|
26
|
+
- [DateTimeSerialization.md](./DateTimeSerialization.md)
|
|
27
|
+
How ChillSharp serializes and parses `DateTimeOffset`, `DateTime`, `DateOnly`, and `TimeOnly`, including comparisons with default ASP.NET Core behavior.
|
|
28
|
+
|
|
29
|
+
- [DateTimePolicy/README.md](./DateTimePolicy/README.md)
|
|
30
|
+
Current DTO policy for `DateTime` and `DateTimeOffset`, including configured timezone handling, UTC normalization, and server-managed audit fields.
|
|
31
|
+
|
|
32
|
+
- [AuthenticationModel/README.md](./AuthenticationModel/README.md)
|
|
33
|
+
Identity-backed account flows, auth-management endpoints, bootstrap strategies, and protected API setup.
|
|
34
|
+
|
|
35
|
+
- [CurrentUserPreferences.md](./CurrentUserPreferences.md)
|
|
36
|
+
Cached authenticated-user culture, time-zone, date-format, and number-format preferences for `IChillContext` and entity lifecycle hooks.
|
|
37
|
+
|
|
38
|
+
- [MenuGuide/README.md](./MenuGuide/README.md)
|
|
39
|
+
Backend-managed menu tree, menu endpoints, and `MenuHierarchy` filtering rules.
|
|
40
|
+
|
|
41
|
+
- [MenuGuide/Relations.md](./MenuGuide/Relations.md)
|
|
42
|
+
Configure EF Core and ChillSharp schema metadata for one-to-many relations.
|
|
43
|
+
|
|
44
|
+
- [UiCore/README.md](./UiCore/README.md)
|
|
45
|
+
Shared Angular UI scope and CRUD menu-task configuration.
|
|
46
|
+
|
|
47
|
+
- [PermissionModel/README.md](./PermissionModel/README.md)
|
|
48
|
+
The permission model used by `ChillSharp.Auth`, including precedence, scopes, and how entity/property access is resolved.
|
|
49
|
+
|
|
50
|
+
- [ComplianceGuide/README.md](./ComplianceGuide/README.md)
|
|
51
|
+
How ChillSharp supports common security and compliance controls such as validation, least-privilege authorization, and audit metadata.
|
|
52
|
+
|
|
53
|
+
- [AIAssistedDevelopment/README.md](./AIAssistedDevelopment/README.md)
|
|
54
|
+
How ChillSharp supports AI-assisted development by reducing repetitive CRUD code, stabilizing the API surface, and keeping model growth more uniform.
|
|
55
|
+
|
|
56
|
+
- [Mcp/README.md](./Mcp/README.md)
|
|
57
|
+
Model Context Protocol module, MCP tool behavior, registration, `EnableMCP`, and guidance for preparing an AI-friendly `DbContext`.
|
|
58
|
+
|
|
59
|
+
- [ClientGeneration/README.md](./ClientGeneration/README.md)
|
|
60
|
+
Generate client libraries from a ChillSharp host for TypeScript and Python using an OpenAPI document exposed by the host application.
|
|
61
|
+
|
|
62
|
+
- [ChillSharpClient.md](./ChillSharpClient.md)
|
|
63
|
+
Use the .NET `ChillSharp.Client` library for core entity operations, auth, schema/menu, i18n, and attachments.
|
|
64
|
+
|
|
65
|
+
- [../ext/chill-sharp-ts-client/README.md](../ext/chill-sharp-ts-client/README.md)
|
|
66
|
+
Generic TypeScript client for ChillSharp services.
|
|
67
|
+
|
|
68
|
+
- [../ext/chill-sharp-react-client/README.md](../ext/chill-sharp-react-client/README.md)
|
|
69
|
+
React provider and hooks built on top of the generic TypeScript client.
|
|
70
|
+
|
|
71
|
+
- [../ext/chill-sharp-vue-client/README.md](../ext/chill-sharp-vue-client/README.md)
|
|
72
|
+
Vue plugin and composables built on top of the generic TypeScript client.
|
|
73
|
+
|
|
74
|
+
- [../ext/chill-sharp-ng-client/README.md](../ext/chill-sharp-ng-client/README.md)
|
|
75
|
+
Angular DI helpers and RxJS service built on top of the generic TypeScript client.
|
|
76
|
+
|
|
77
|
+
- [../ext/chill-sharp-py-client/README.md](../ext/chill-sharp-py-client/README.md)
|
|
78
|
+
Generic Python client for ChillSharp services.
|
|
79
|
+
|
|
80
|
+
## Main Modules
|
|
81
|
+
|
|
82
|
+
- `ChillSharp`
|
|
83
|
+
Core entity engine, DTO engine, and HTTP API surface.
|
|
84
|
+
|
|
85
|
+
- `ChillSharp.Schema`
|
|
86
|
+
Schema generation, persistence, and schema cache.
|
|
87
|
+
|
|
88
|
+
- `ChillSharp.Attachment`
|
|
89
|
+
Attachment entity model, archive storage, and upload/download endpoints.
|
|
90
|
+
|
|
91
|
+
- `ChillSharp.Auth`
|
|
92
|
+
Authorization model, permission rules, role/user management, and optional ASP.NET Core Identity integration.
|
|
93
|
+
|
|
94
|
+
- `ChillSharp.I18n`
|
|
95
|
+
Label and text lookup endpoints plus an in-memory i18n cache.
|
|
96
|
+
|
|
97
|
+
- `ChillSharp.Client`
|
|
98
|
+
.NET client for ChillSharp and ChillSharp.Auth endpoints.
|
|
99
|
+
|
|
100
|
+
- `ChillSharp.Mcp`
|
|
101
|
+
MCP server module built on the official C# SDK, exposing ChillSharp schema discovery and query tools for AI clients.
|
|
102
|
+
|
|
103
|
+
- `ext/chill-sharp-ts-client`
|
|
104
|
+
Generic TypeScript client package.
|
|
105
|
+
|
|
106
|
+
- `ext/chill-sharp-react-client`
|
|
107
|
+
React integration package layered on top of the TypeScript client.
|
|
108
|
+
|
|
109
|
+
- `ext/chill-sharp-vue-client`
|
|
110
|
+
Vue integration package layered on top of the TypeScript client.
|
|
111
|
+
|
|
112
|
+
- `ext/chill-sharp-ng-client`
|
|
113
|
+
Angular integration package layered on top of the TypeScript client.
|
|
114
|
+
|
|
115
|
+
- `ext/chill-sharp-py-client`
|
|
116
|
+
Generic Python client package.
|
|
117
|
+
|
|
118
|
+
## Core Concepts
|
|
119
|
+
|
|
120
|
+
### `IChillContext`
|
|
121
|
+
|
|
122
|
+
Your EF Core context must implement `IChillContext`. It defines:
|
|
123
|
+
|
|
124
|
+
- the Chill type prefix used for dynamic activation
|
|
125
|
+
- the primary and secondary cultures used to interpret schema labels
|
|
126
|
+
- the current user name used by entity audit tracking
|
|
127
|
+
|
|
128
|
+
Different contexts can coexist with different values. ChillSharp does not assume a single global configuration.
|
|
129
|
+
|
|
130
|
+
### `ChillEntity`
|
|
131
|
+
|
|
132
|
+
`ChillEntity` is the recommended base class for model types exposed through ChillSharp. It already provides:
|
|
133
|
+
|
|
134
|
+
- `Guid`
|
|
135
|
+
- `Position`
|
|
136
|
+
- `Label`, `ShortLabel`, `FullTextContent`
|
|
137
|
+
- `Checksum`, `LastUpdateUser`, `LastUpdate`, `LastUpdateUtcOffset`
|
|
138
|
+
- default lifecycle behavior
|
|
139
|
+
|
|
140
|
+
Lifecycle hooks are:
|
|
141
|
+
|
|
142
|
+
- `OnCreate`
|
|
143
|
+
- `OnUpdate`
|
|
144
|
+
- `OnAfterUpdate`
|
|
145
|
+
- `OnDelete`
|
|
146
|
+
- `OnAfterDelete`
|
|
147
|
+
- `OnSelect`
|
|
148
|
+
- `OnInflate`
|
|
149
|
+
- `OnAutocomplete`
|
|
150
|
+
|
|
151
|
+
### Schema Metadata
|
|
152
|
+
|
|
153
|
+
`ChillEntityAttribute` and `ChillPropertyAttribute` provide:
|
|
154
|
+
|
|
155
|
+
- stable unique keys
|
|
156
|
+
- `PrimaryLanguageLabel`
|
|
157
|
+
- `SecondaryLanguageLabel`
|
|
158
|
+
|
|
159
|
+
When ChillSharp builds a schema, it resolves those labels using:
|
|
160
|
+
|
|
161
|
+
- `CultureInfo.CurrentUICulture`
|
|
162
|
+
- `IChillContext.GetPrimaryCultureName()`
|
|
163
|
+
- `IChillContext.GetSecondaryCultureName()`
|
|
164
|
+
|
|
165
|
+
### Audit Fields
|
|
166
|
+
|
|
167
|
+
After updates, ChillSharp automatically stores:
|
|
168
|
+
|
|
169
|
+
- `Checksum`
|
|
170
|
+
- `LastUpdateUser`
|
|
171
|
+
- `LastUpdate`
|
|
172
|
+
- `LastUpdateUtcOffset`
|
|
173
|
+
|
|
174
|
+
The audit logic is enforced through the `IChillEntity` interface path used by `ChillEngine`, so a derived class can override `OnAfterUpdate()` without bypassing the base audit update.
|
|
175
|
+
|
|
176
|
+
### Query Ordering
|
|
177
|
+
|
|
178
|
+
`ChillDtoQuery` includes an `Ordering` object that mirrors `Pagination`:
|
|
179
|
+
|
|
180
|
+
- `PropertyName`
|
|
181
|
+
- `Direction`
|
|
182
|
+
|
|
183
|
+
If the client does not send an explicit ordering, ChillSharp applies `Position` by default. `Position` is part of both `ChillEntity` and `ChillDtoEntity`, and defaults to `0`.
|
|
184
|
+
|
|
185
|
+
When `PropertyName` points to a referenced Chill entity, ordering is applied using the referenced entity `Label`. This keeps generic list screens readable without requiring clients to know the foreign-key internals.
|
|
186
|
+
|
|
187
|
+
## API Surface
|
|
188
|
+
|
|
189
|
+
The core mapped API is exposed by:
|
|
190
|
+
|
|
191
|
+
- `app.MapChillApi()`
|
|
192
|
+
|
|
193
|
+
This maps the Chill API controllers and also includes:
|
|
194
|
+
|
|
195
|
+
- `/api/chill/query`
|
|
196
|
+
- `/api/chill/lookup`
|
|
197
|
+
- `/api/chill/test`
|
|
198
|
+
- `/api/chill/license`
|
|
199
|
+
|
|
200
|
+
Depending on which modules are registered, the same host can also expose:
|
|
201
|
+
|
|
202
|
+
- schema services through `ChillSharp.Schema`
|
|
203
|
+
- attachment upload/download services through `ChillSharp.Attachment`
|
|
204
|
+
- auth/account and permission-management services through `ChillSharp.Auth`
|
|
205
|
+
- i18n text endpoints through `ChillSharp.I18n`
|
|
206
|
+
|
|
207
|
+
## Reference vs How-To
|
|
208
|
+
|
|
209
|
+
Use this split consistently:
|
|
210
|
+
|
|
211
|
+
- `doc/HowTo`
|
|
212
|
+
Step-by-step tutorials. Keep these focused and task-oriented.
|
|
213
|
+
|
|
214
|
+
- the rest of `doc/`
|
|
215
|
+
Reference documentation. Use these files when you need the model, registration, architecture, permission rules, or integration details.
|
|
216
|
+
|
|
217
|
+
## How-To
|
|
218
|
+
|
|
219
|
+
The existing tutorials remain unchanged:
|
|
220
|
+
|
|
221
|
+
- [HowTo/01-simple-blog-sqlite.md](./HowTo/01-simple-blog-sqlite.md)
|
|
222
|
+
- [HowTo/02-blog-schema-labels.md](./HowTo/02-blog-schema-labels.md)
|
|
223
|
+
- [HowTo/03-authentication.md](./HowTo/03-authentication.md)
|
|
224
|
+
- [HowTo/04-blog-posts-one-to-many.md](./HowTo/04-blog-posts-one-to-many.md)
|
|
225
|
+
- [HowTo/05-docker-env-variables.md](./HowTo/05-docker-env-variables.md)
|
|
226
|
+
- [HowTo/06-chunk-transactions-autocomplete.md](./HowTo/06-chunk-transactions-autocomplete.md)
|
|
227
|
+
|
|
228
|
+
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Checking EF Core Reference Presence Without Loading
|
|
2
|
+
|
|
3
|
+
Versione italiana: [Italiano](./it/ReferenceExistence.md)
|
|
4
|
+
|
|
5
|
+
`ChillSharp.EF.ChillEntryExtension.Exist()` answers a small but useful question: does this reference navigation currently have all of its configured foreign-key values?
|
|
6
|
+
|
|
7
|
+
```csharp
|
|
8
|
+
using ChillSharp.EF;
|
|
9
|
+
|
|
10
|
+
var hasCustomerReference = context.Entry(order)
|
|
11
|
+
.Reference(x => x.Customer)
|
|
12
|
+
.Exist();
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The call reads the current values of the FK properties from EF Core's change tracker. With the default argument, it does not query the database and does not load `order.Customer`.
|
|
16
|
+
|
|
17
|
+
> The extension is named `Exist`, not `Exists`. Its signature is `Exist(bool loadIfExist = false)`.
|
|
18
|
+
|
|
19
|
+
## When To Use It
|
|
20
|
+
|
|
21
|
+
Use `Exist()` in model logic that needs to distinguish an absent optional relationship from a relationship that has been assigned, while avoiding an unnecessary load of the principal entity. It is particularly useful in `OnUpdate`, `OnSelect`, or DTO-processing logic where only the branching decision is needed.
|
|
22
|
+
|
|
23
|
+
```csharp
|
|
24
|
+
public override void OnUpdate(IChillContext context)
|
|
25
|
+
{
|
|
26
|
+
var db = (AppDbContext)context;
|
|
27
|
+
|
|
28
|
+
if (db.Entry(this).Reference(x => x.Customer).Exist())
|
|
29
|
+
{
|
|
30
|
+
// A customer FK value has been assigned. Customer is still not loaded.
|
|
31
|
+
CustomerSummaryRequired = true;
|
|
32
|
+
}
|
|
33
|
+
else
|
|
34
|
+
{
|
|
35
|
+
CustomerSummaryRequired = false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
This is preferable to inspecting `Customer != null` when the navigation may simply be unloaded. A null navigation does not distinguish “no relationship” from “relationship not loaded.”
|
|
41
|
+
|
|
42
|
+
## Optional Loading
|
|
43
|
+
|
|
44
|
+
Pass `true` only when the next operation actually needs the related entity:
|
|
45
|
+
|
|
46
|
+
```csharp
|
|
47
|
+
var customerReference = context.Entry(order).Reference(x => x.Customer);
|
|
48
|
+
|
|
49
|
+
if (customerReference.Exist(loadIfExist: true) && order.Customer is { } customer)
|
|
50
|
+
{
|
|
51
|
+
// EF Core loaded Customer when it was not already loaded.
|
|
52
|
+
var customerName = customer.Name;
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The behavior is:
|
|
57
|
+
|
|
58
|
+
| Call | FK values are incomplete or null | FK values are present and navigation is unloaded | Navigation loaded? |
|
|
59
|
+
| --- | --- | --- | --- |
|
|
60
|
+
| `Exist()` | Returns `false` | Returns `true` | No new load |
|
|
61
|
+
| `Exist(true)` | Returns `false` | Returns `true` | Attempts to load the reference |
|
|
62
|
+
|
|
63
|
+
If the navigation was already loaded, neither form loads it again. Because the result still describes FK values, `Exist(true)` can return `true` while the loaded navigation is null when an FK-less database contains an orphaned value.
|
|
64
|
+
|
|
65
|
+
## FK-Less Database Does Not Mean Relationship-Less Model
|
|
66
|
+
|
|
67
|
+
This extension works with a legacy or FK-less database implementation only if EF Core still knows the relationship and its dependent FK properties. A physical database constraint and EF Core relationship metadata are separate concerns.
|
|
68
|
+
|
|
69
|
+
For example, the database may not enforce a constraint from `Order.CustomerGuid` to `Customer.Guid`, but the EF model still needs the scalar FK and relationship mapping:
|
|
70
|
+
|
|
71
|
+
```csharp
|
|
72
|
+
public sealed class Order : ChillEntity
|
|
73
|
+
{
|
|
74
|
+
public Guid? CustomerGuid { get; set; }
|
|
75
|
+
public Customer? Customer { get; set; }
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
79
|
+
{
|
|
80
|
+
modelBuilder.Entity<Order>()
|
|
81
|
+
.HasOne(x => x.Customer)
|
|
82
|
+
.WithMany()
|
|
83
|
+
.HasForeignKey(x => x.CustomerGuid);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`Exist()` reads `CustomerGuid` through this mapping. A relationship that is not configured in EF Core has no `ReferenceEntry` FK metadata for the extension to inspect; in that case, use the scalar key directly or configure the relationship.
|
|
88
|
+
|
|
89
|
+
Shadow FK properties are supported as long as EF Core has mapped the navigation. The extension obtains the FK property metadata from the navigation, rather than requiring a public CLR FK property.
|
|
90
|
+
|
|
91
|
+
## What The Result Means
|
|
92
|
+
|
|
93
|
+
`Exist()` is a local FK-value presence test. It does not issue an existence query for the principal row.
|
|
94
|
+
|
|
95
|
+
Consequently:
|
|
96
|
+
|
|
97
|
+
- `true` means every configured FK component is non-null in the tracked dependent entry.
|
|
98
|
+
- `false` means at least one FK component is null.
|
|
99
|
+
- `true` does not guarantee that the related row exists, especially when the database does not enforce FK constraints or contains legacy orphaned values.
|
|
100
|
+
- `true` does not mean the navigation is loaded.
|
|
101
|
+
|
|
102
|
+
If the business rule requires proof that a principal row exists, query for it explicitly, for example with `AnyAsync`, or use `Exist(true)` and then handle a null loaded navigation. Prefer the explicit query when you need a server-side existence check without materializing the principal.
|
|
103
|
+
|
|
104
|
+
```csharp
|
|
105
|
+
var customerRowExists = await context.Set<Customer>()
|
|
106
|
+
.AnyAsync(x => x.Guid == order.CustomerGuid, cancellationToken);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Composite Keys And Value Conventions
|
|
110
|
+
|
|
111
|
+
For a composite FK, `Exist()` returns `true` only when every component is non-null. A partially populated composite key returns `false`.
|
|
112
|
+
|
|
113
|
+
The extension checks for `null`; it does not validate sentinel values. For example, `Guid.Empty`, `0`, or an empty string is non-null and can therefore produce `true` if that is the value currently stored. Use validation appropriate to the domain when those values mean “unassigned.”
|
|
114
|
+
|
|
115
|
+
## Preconditions And Failure Modes
|
|
116
|
+
|
|
117
|
+
The entity must be attached to the same EF Core `DbContext` used to obtain its entry. Call the extension on the dependent-side reference navigation: the entity in the `ReferenceEntry` must own the FK properties that EF Core reports for that navigation. Calling it for a non-reference member, a navigation with no usable FK relationship metadata, or the principal-side navigation of a one-to-one relationship can throw `InvalidOperationException` because those FK properties do not belong to the inspected entry.
|
|
118
|
+
|
|
119
|
+
Do not use it for collection navigations. A collection needs a different question—whether at least one related row exists—which normally requires a database query.
|
|
120
|
+
|
|
121
|
+
## Decision Guide
|
|
122
|
+
|
|
123
|
+
| Need | Use |
|
|
124
|
+
| --- | --- |
|
|
125
|
+
| Determine whether an optional reference has assigned FK values; do not load it | `Reference(...).Exist()` |
|
|
126
|
+
| Load the reference only if FK values are assigned | `Reference(...).Exist(true)` |
|
|
127
|
+
| Prove the principal row exists | An explicit `Any`/`AnyAsync` query |
|
|
128
|
+
| Determine whether a collection has members | A query against the dependent set |
|
|
129
|
+
|
|
130
|
+
Keep `Exist()` for the narrow FK-presence decision. Its value is that it makes that intent explicit and avoids a related-entity load when the load is unnecessary.
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# Registering A ChillSharp Context
|
|
2
|
+
|
|
3
|
+
Versione italiana: [Italiano](./it/RegisterContext.md)
|
|
4
|
+
|
|
5
|
+
This document shows how to wire ChillSharp modules into an ASP.NET Core host.
|
|
6
|
+
|
|
7
|
+
## Minimal Core API
|
|
8
|
+
|
|
9
|
+
For the core Chill API only:
|
|
10
|
+
|
|
11
|
+
```csharp
|
|
12
|
+
using ChillSharp.Api;
|
|
13
|
+
using Microsoft.EntityFrameworkCore;
|
|
14
|
+
|
|
15
|
+
var builder = WebApplication.CreateBuilder(args);
|
|
16
|
+
|
|
17
|
+
builder.Services.AddDbContext<AppDbContext>(options =>
|
|
18
|
+
options.UseSqlite("Data Source=app.db"));
|
|
19
|
+
|
|
20
|
+
builder.Services.AddChillApi<AppDbContext>();
|
|
21
|
+
|
|
22
|
+
var app = builder.Build();
|
|
23
|
+
app.MapChillApi();
|
|
24
|
+
app.Run();
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Requirements:
|
|
28
|
+
|
|
29
|
+
- `AppDbContext` must inherit `DbContext`
|
|
30
|
+
- `AppDbContext` must implement `IChillContext`
|
|
31
|
+
|
|
32
|
+
## What `AddChillApi<TContext>()` Registers
|
|
33
|
+
|
|
34
|
+
The core registration sets up:
|
|
35
|
+
|
|
36
|
+
- ChillSharp controllers
|
|
37
|
+
- `IChillContext` resolution from your host context
|
|
38
|
+
- `IChillDtoEngine`
|
|
39
|
+
- optional protected API behavior through `ChillApiOptions`
|
|
40
|
+
|
|
41
|
+
## Protecting The Core API
|
|
42
|
+
|
|
43
|
+
If the host already configures authentication and authorization, you can require auth on the Chill API:
|
|
44
|
+
|
|
45
|
+
```csharp
|
|
46
|
+
builder.Services.AddChillApi<AppDbContext>(options =>
|
|
47
|
+
{
|
|
48
|
+
options.ProtectedApi = true;
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Then use the standard ASP.NET Core middleware:
|
|
53
|
+
|
|
54
|
+
```csharp
|
|
55
|
+
app.UseAuthentication();
|
|
56
|
+
app.UseAuthorization();
|
|
57
|
+
app.MapChillApi();
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Adding Schema Services
|
|
61
|
+
|
|
62
|
+
To persist and serve schema metadata:
|
|
63
|
+
|
|
64
|
+
```csharp
|
|
65
|
+
using ChillSharp.Schema;
|
|
66
|
+
|
|
67
|
+
builder.Services.AddChillSchema<AppDbContext>();
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Context requirements:
|
|
71
|
+
|
|
72
|
+
- `AppDbContext : IChillSchemaDbContext`
|
|
73
|
+
- `modelBuilder.AddChillSchemaModel()`
|
|
74
|
+
|
|
75
|
+
`ChillSharp.Schema` also owns the schema cache registration.
|
|
76
|
+
|
|
77
|
+
## Adding Auth Management
|
|
78
|
+
|
|
79
|
+
To expose auth-management endpoints without ASP.NET Core Identity account flows:
|
|
80
|
+
|
|
81
|
+
```csharp
|
|
82
|
+
using ChillSharp.Auth.Api;
|
|
83
|
+
|
|
84
|
+
builder.Services.AddChillAuthApi<AppDbContext>();
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Context requirements:
|
|
88
|
+
|
|
89
|
+
- `AppDbContext : IChillAuthDbContext`
|
|
90
|
+
- `modelBuilder.AddChillAuthModel()`
|
|
91
|
+
|
|
92
|
+
This adds endpoints for:
|
|
93
|
+
|
|
94
|
+
- auth users
|
|
95
|
+
- roles
|
|
96
|
+
- user-role assignments
|
|
97
|
+
- permission rules
|
|
98
|
+
- permission evaluation
|
|
99
|
+
|
|
100
|
+
## Adding Identity Account Flows
|
|
101
|
+
|
|
102
|
+
To expose account registration, login, refresh tokens, password change, and password reset:
|
|
103
|
+
|
|
104
|
+
```csharp
|
|
105
|
+
using ChillSharp.Auth;
|
|
106
|
+
using ChillSharp.Auth.Api;
|
|
107
|
+
using Microsoft.AspNetCore.Identity;
|
|
108
|
+
|
|
109
|
+
builder.Services.AddIdentityCore<IdentityUser>()
|
|
110
|
+
.AddEntityFrameworkStores<AppDbContext>()
|
|
111
|
+
.AddSignInManager()
|
|
112
|
+
.AddDefaultTokenProviders();
|
|
113
|
+
|
|
114
|
+
builder.Services.AddAuthentication(ChillAuthIdentityDefaults.AuthenticationScheme)
|
|
115
|
+
.AddChillAuthBearer();
|
|
116
|
+
|
|
117
|
+
builder.Services.AddAuthorization();
|
|
118
|
+
|
|
119
|
+
builder.Services.AddChillApi<AppDbContext, IdentityUser>();
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
This overload builds on the normal Chill API registration and adds the Identity-backed auth endpoints without requiring a second ChillSharp registration call.
|
|
123
|
+
|
|
124
|
+
## Adding I18n Services
|
|
125
|
+
|
|
126
|
+
To expose i18n endpoints:
|
|
127
|
+
|
|
128
|
+
```csharp
|
|
129
|
+
using ChillSharp.I18n.Api;
|
|
130
|
+
|
|
131
|
+
builder.Services.AddChillI18nApi<AppDbContext>();
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Context requirements:
|
|
135
|
+
|
|
136
|
+
- `AppDbContext : IChillI18nDbContext`
|
|
137
|
+
- `modelBuilder.AddChillI18nModel()`
|
|
138
|
+
|
|
139
|
+
The module currently exposes:
|
|
140
|
+
|
|
141
|
+
- `GET /api/chill-i18n/text/{labelGuid}/{cultureName}`
|
|
142
|
+
- `PUT /api/chill-i18n/text`
|
|
143
|
+
|
|
144
|
+
## Full Host Example
|
|
145
|
+
|
|
146
|
+
```csharp
|
|
147
|
+
using ChillSharp.Api;
|
|
148
|
+
using ChillSharp.Auth;
|
|
149
|
+
using ChillSharp.Auth.Api;
|
|
150
|
+
using ChillSharp.I18n.Api;
|
|
151
|
+
using ChillSharp.Schema;
|
|
152
|
+
using Microsoft.AspNetCore.Identity;
|
|
153
|
+
using Microsoft.EntityFrameworkCore;
|
|
154
|
+
|
|
155
|
+
var builder = WebApplication.CreateBuilder(args);
|
|
156
|
+
|
|
157
|
+
builder.Services.AddDbContext<AppDbContext>(options =>
|
|
158
|
+
options.UseSqlite("Data Source=app.db"));
|
|
159
|
+
|
|
160
|
+
builder.Services.AddIdentityCore<IdentityUser>()
|
|
161
|
+
.AddEntityFrameworkStores<AppDbContext>()
|
|
162
|
+
.AddSignInManager()
|
|
163
|
+
.AddDefaultTokenProviders();
|
|
164
|
+
|
|
165
|
+
builder.Services.AddAuthentication(ChillAuthIdentityDefaults.AuthenticationScheme)
|
|
166
|
+
.AddChillAuthBearer();
|
|
167
|
+
builder.Services.AddAuthorization();
|
|
168
|
+
|
|
169
|
+
builder.Services.AddChillApi<AppDbContext, IdentityUser>(options =>
|
|
170
|
+
{
|
|
171
|
+
options.ProtectedApi = true;
|
|
172
|
+
});
|
|
173
|
+
builder.Services.AddChillSchema<AppDbContext>();
|
|
174
|
+
|
|
175
|
+
var app = builder.Build();
|
|
176
|
+
|
|
177
|
+
app.UseAuthentication();
|
|
178
|
+
app.UseAuthorization();
|
|
179
|
+
app.MapChillApi();
|
|
180
|
+
app.Run();
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Mapping Behavior
|
|
184
|
+
|
|
185
|
+
`app.MapChillApi()` maps the ChillSharp controllers and helper endpoints. It does not replace standard ASP.NET Core middleware setup. You still need:
|
|
186
|
+
|
|
187
|
+
- `UseAuthentication()` if auth is enabled
|
|
188
|
+
- `UseAuthorization()` if authorization is enabled
|
|
189
|
+
|
|
190
|
+
I18n and auth controllers are added through controller discovery when their modules are registered.
|
|
191
|
+
|
|
192
|
+
## Recommended Startup Order
|
|
193
|
+
|
|
194
|
+
1. register the EF Core context
|
|
195
|
+
2. register Identity if needed
|
|
196
|
+
3. register authentication and authorization if needed
|
|
197
|
+
4. register `AddChillApi<TContext>()`
|
|
198
|
+
5. register optional modules or use the combined Identity overload
|
|
199
|
+
6. build app
|
|
200
|
+
7. apply middleware
|
|
201
|
+
8. map Chill API
|
|
202
|
+
|
|
203
|
+
## OpenAPI / Swagger
|
|
204
|
+
|
|
205
|
+
ChillSharp itself does not force Swagger into your host. If you want OpenAPI output for documentation or client generation, add it in the host application:
|
|
206
|
+
|
|
207
|
+
```csharp
|
|
208
|
+
builder.Services.AddEndpointsApiExplorer();
|
|
209
|
+
builder.Services.AddSwaggerGen();
|
|
210
|
+
|
|
211
|
+
var app = builder.Build();
|
|
212
|
+
app.UseSwagger();
|
|
213
|
+
app.UseSwaggerUI();
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
That is the recommended base for generating TypeScript and Python clients from a ChillSharp host.
|
|
217
|
+
|