Source Generation
Instagile.nukpg includes a source generator which produces entity types based on .theModel files. To control generation, add MSBuild Items to a .csproj file.
Item list
| Item name | What it generates | Corresponding T4 templates |
|---|---|---|
| ModelFeature | Nothing directly - extra events are included in this project's models. | |
| GenerateEntities | Entity types, typed metadata, typed properties, stringifying reports. | Entities/Metadata.tt |
| GenerateScreens | Base classes for screen customisation | Controllers/Models/Factories.tt |
| GenerateSpecifications | Deprecated query types for search screen customisation. | Specifications.tt |
| GenerateSQL | Schema metadata for SQLEntityStore. | SQLPersistence.tt |
Examples
Generate the core types needed for the ORM, as well as typed search specifications (in My.Model.csproj):
<ItemGroup>
<GenerateEntities Include="My.Model.theModel" />
<GenerateSpecifications Include="My.Model.theModel" />
</ItemGroup>
Generate SQL in a different project (in My.Website.csproj):
<ItemGroup>
<GenerateSQL Include="..\My.Model\My.Model.theModel" />
</ItemGroup>
Generate WPF screens using a custom modelfeatures (in My.App.csproj):
<ItemGroup>
<ModelFeature Include="..\My.Model\Custom.theFeature" />
<GenerateScreens Include="..\My.Model\My.Model.theModel" />
<GenerateSpecifications Include="..\My.Model\My.Model.theModel" />
</ItemGroup>