|
2 | 2 |
|
3 | 3 | A first-class full-stack target on .NET 8. Loader + conformance + EF Core codegen |
4 | 4 | + render engine + the `meta` CLI all ship. Targets EF Core + ASP.NET Core + |
5 | | -Postgres + Npgsql. |
| 5 | +Postgres + Npgsql. The baseline is **.NET 8** (`net8.0`); the tool and the packages are not |
| 6 | +built for earlier runtimes. |
| 7 | + |
| 8 | +## Regeneration and hand edits |
| 9 | + |
| 10 | +`dotnet meta gen` has no three-way merge (that is TypeScript-only). It decides per file from a |
| 11 | +committed hash manifest, `.metaobjects/.gen-state/.hashes.json`: a file that still matches what |
| 12 | +the generator wrote is overwritten, and an edited one is refused by name. To change what a |
| 13 | +generator emits, `dotnet meta eject <name>` copies it into `codegen/generators/` for you to own. |
| 14 | +Commit the manifest. |
| 15 | + |
| 16 | +## Keep your EF Core model: contracts as plain DTOs |
| 17 | + |
| 18 | +Contracts and entities are not forced into one type. Declare an object with **no |
| 19 | +`source.rdb`** (a *sourceless* object) and `EntityGenerator` writes a POCO with DataAnnotations |
| 20 | +and **no EF mapping**: no `[Table]`, no `DbSet<>`, no `AppDbContext` entry, no CRUD routes, no |
| 21 | +filter allowlist. A sourced entity gets `[Table]`/`[Key]`/`[Column]` and the full EF Core |
| 22 | +surface. So the same model can hold sourceless request/response contracts that you hand to your |
| 23 | +own controllers and sourced entities where you want MetaObjects to own the mapping; your |
| 24 | +existing hand-written EF entities are not touched. |
| 25 | + |
| 26 | +A declaration with no `source.rdb` (this one is a plain DTO POCO): |
| 27 | + |
| 28 | +```json |
| 29 | +{ "object.entity": { |
| 30 | + "name": "AuthorSummary", |
| 31 | + "children": [ |
| 32 | + { "field.long": { "name": "id" } }, |
| 33 | + { "field.string": { "name": "name", "@required": true, "@maxLength": 200 } }, |
| 34 | + { "identity.primary": { "@fields": "id" } } |
| 35 | + ] |
| 36 | +}} |
| 37 | +``` |
| 38 | + |
| 39 | +Wire only the generators you want in `codegen/Generators.cs`; leave `db-context` out if you keep your own `DbContext`, since the generated `AppDbContext` emits Postgres column types (`uuid`, `jsonb`, `timestamptz`) today. Note that the generated CRUD |
| 40 | +routes use the *entity* POCO, as described under [Use](#use); the DTO shape above is for |
| 41 | +objects you keep sourceless. |
6 | 42 |
|
7 | 43 | ## Install |
8 | 44 |
|
@@ -720,8 +756,17 @@ ship too — the generated `<Entity>FilterAllowlist` (`FilterAllowlistGenerator` |
720 | 756 | feeds `FilterParser.Parse` + `EfCoreFilterDispatch.ApplyFilter`, both wired |
721 | 757 | directly into the generated list handler. A read-only projection |
722 | 758 | (`source.rdb @kind: view`) and a view-backed report get the same filter and sort |
723 | | -on their list route, against an allowlist of their own fields. Remaining gaps are in |
724 | | -[`server/csharp/MetaObjects.Codegen/Generators/KNOWN_GAPS.md`](../../server/csharp/MetaObjects.Codegen/Generators/KNOWN_GAPS.md). |
| 759 | +on their list route, against an allowlist of their own fields. |
| 760 | + |
| 761 | +**Known gaps** (full list with workarounds in |
| 762 | +[KNOWN_GAPS.md](https://github.com/metaobjectsdev/metaobjects/blob/main/server/csharp/MetaObjects.Codegen/Generators/KNOWN_GAPS.md)): |
| 763 | +no `filter[or]` / `filter[and]` boolean grouping and a single sort key only (both outside the |
| 764 | +cross-port contract today); the `<Entity>View` / `<Entity>Views` names are reserved for a |
| 765 | +write-through entity's generated read model; an `EmitMappedClass` override does not reach that |
| 766 | +read model; M:N traversal on a write-through entity is not routed through the replica view; the |
| 767 | +ordered-comparison filter fallback in `EfCoreFilterDispatch` needs a hand-written typed |
| 768 | +dispatcher for some column types; there is no metadata-driven runtime tier (EF Core output is |
| 769 | +generated code), and no `migrate` surface (schema is TypeScript-owned). |
725 | 770 |
|
726 | 771 | ## Capability snapshot |
727 | 772 |
|
|
0 commit comments