@chill-sharp/ui-core 1.1.12 → 1.1.15

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.
Files changed (69) hide show
  1. package/README.md +103 -103
  2. package/fesm2022/chill-sharp-ui-core.mjs +2446 -2446
  3. package/fesm2022/chill-sharp-ui-core.mjs.map +1 -1
  4. package/lib/lib/chill-form.component.d.ts +1 -1
  5. package/package.json +3 -3
  6. package/service-worker/chill-sharp-service-worker.js +166 -166
  7. package/styles/core-theme.scss +1235 -1235
  8. package/.agents/skills/chillsharp-current-user-preferences/SKILL.md +0 -70
  9. package/.agents/skills/chillsharp-ui-template/SKILL.md +0 -18
  10. package/doc/AIAssistedDevelopment/README.md +0 -185
  11. package/doc/AttachmentModel/README.md +0 -173
  12. package/doc/AuthenticationModel/README.md +0 -213
  13. package/doc/AuthenticationModel/how-to-integreate-auth-minimal-api.md +0 -293
  14. package/doc/ChillSharpClient.md +0 -464
  15. package/doc/ClientGeneration/README.md +0 -172
  16. package/doc/ComplianceGuide/README.md +0 -178
  17. package/doc/Configuration/README.md +0 -94
  18. package/doc/CurrentUserPreferences.md +0 -114
  19. package/doc/DateTimePolicy/README.md +0 -154
  20. package/doc/DateTimeSerialization.md +0 -423
  21. package/doc/Endpoints.md +0 -260
  22. package/doc/HowTo/01-simple-blog-sqlite.md +0 -153
  23. package/doc/HowTo/02-blog-schema-labels.md +0 -140
  24. package/doc/HowTo/03-authentication.md +0 -218
  25. package/doc/HowTo/04-blog-posts-one-to-many.md +0 -194
  26. package/doc/HowTo/05-docker-env-variables.md +0 -274
  27. package/doc/HowTo/06-chunk-transactions-autocomplete.md +0 -196
  28. package/doc/Mcp/ChatGPT.md +0 -291
  29. package/doc/Mcp/README.md +0 -799
  30. package/doc/MenuGuide/README.md +0 -49
  31. package/doc/ModelPreparation.md +0 -255
  32. package/doc/PermissionModel/README.md +0 -277
  33. package/doc/README.md +0 -228
  34. package/doc/ReferenceExistence.md +0 -130
  35. package/doc/RegisterContext.md +0 -217
  36. package/doc/UiCore/CRUD.md +0 -170
  37. package/doc/UiCore/README.md +0 -13
  38. package/doc/ValidationModel/README.md +0 -117
  39. package/doc/it/AIAssistedDevelopment/README.md +0 -185
  40. package/doc/it/AttachmentModel/README.md +0 -173
  41. package/doc/it/AuthenticationModel/README.md +0 -171
  42. package/doc/it/AuthenticationModel/how-to-integreate-auth-minimal-api.md +0 -292
  43. package/doc/it/ChillSharpClient.md +0 -464
  44. package/doc/it/ClientGeneration/README.md +0 -152
  45. package/doc/it/ComplianceGuide/README.md +0 -178
  46. package/doc/it/Configuration/README.md +0 -94
  47. package/doc/it/CurrentUserPreferences.md +0 -114
  48. package/doc/it/DateTimePolicy/README.md +0 -154
  49. package/doc/it/DateTimeSerialization.md +0 -423
  50. package/doc/it/Endpoints.md +0 -260
  51. package/doc/it/HowTo/01-simple-blog-sqlite.md +0 -152
  52. package/doc/it/HowTo/02-blog-schema-labels.md +0 -139
  53. package/doc/it/HowTo/03-authentication.md +0 -221
  54. package/doc/it/HowTo/04-blog-posts-one-to-many.md +0 -193
  55. package/doc/it/HowTo/05-docker-env-variables.md +0 -268
  56. package/doc/it/HowTo/06-chunk-transactions-autocomplete.md +0 -196
  57. package/doc/it/Mcp/ChatGPT.md +0 -291
  58. package/doc/it/Mcp/README.md +0 -799
  59. package/doc/it/MenuGuide/README.md +0 -49
  60. package/doc/it/ModelPreparation.md +0 -254
  61. package/doc/it/PermissionModel/README.md +0 -190
  62. package/doc/it/README.md +0 -172
  63. package/doc/it/ReferenceExistence.md +0 -130
  64. package/doc/it/RegisterContext.md +0 -218
  65. package/doc/it/UiCore/CRUD.md +0 -170
  66. package/doc/it/UiCore/README.md +0 -13
  67. package/doc/it/ValidationModel/README.md +0 -117
  68. package/template-customization/upgrade.ps1.template +0 -342
  69. package/template-customization/upgrade.sh.template +0 -271
package/doc/README.md DELETED
@@ -1,228 +0,0 @@
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
-
@@ -1,130 +0,0 @@
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.
@@ -1,217 +0,0 @@
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
-