pauldeen79.ClassFramework.Domain
0.15.0
See the version list below for details.
dotnet add package pauldeen79.ClassFramework.Domain --version 0.15.0
NuGet\Install-Package pauldeen79.ClassFramework.Domain -Version 0.15.0
<PackageReference Include="pauldeen79.ClassFramework.Domain" Version="0.15.0" />
paket add pauldeen79.ClassFramework.Domain --version 0.15.0
#r "nuget: pauldeen79.ClassFramework.Domain, 0.15.0"
// Install pauldeen79.ClassFramework.Domain as a Cake Addin #addin nuget:?package=pauldeen79.ClassFramework.Domain&version=0.15.0 // Install pauldeen79.ClassFramework.Domain as a Cake Tool #tool nuget:?package=pauldeen79.ClassFramework.Domain&version=0.15.0
ClassFramework
Class modeling framework for C#
If you want to create a C# class structure based on a model, this framework is for you!
We are using the following dependencies:
- CsharpExpressionDumper, to generate c# code for values
- CrossCutting.ProcessingPipeline, for extendable pipelines for transformation of classes and interfaces
- CrossCutting.Utilities.Parsers, for parsing named format strings like
{Name}Builder
- TemplateFramework, to translate the domain model to actual c# code files
The Domain and Pipelines packages target .NET Standard 2.0, so you can use it anywhere. Because of the dependency to TemplateFramework, we target some projects to .NET 8.0.
Background
Imagine you want to create some domain model for a new project.
First, you need to create a console project named [YourProjectName].CodeGeneration
.
In this project, there are a number of components:
- The Program.cs class, which runs the code generation
- The Models folder, which contains interfaces for all your domain entities
- The CodeGenerationProviders folder, which contains all types of code generators, like entities, builders and maybe abstractions
Philosophy
The entity and builder generators use the following characteristics:
- The entity can be either a POCO or a DDD-style object, which takes all input in the constructor and then validates the state
- You can use either immutable or mutable entities, and you can choose to make the setters private or public
- You can use observable properties on entities, if you need to
- For immutable entities, you can also generate builders. These are mutable, and you can easily convert between the two types (unless you want the entities in a separate project, without a reference to the builders)
- Validation is supported using the IValidatableObject interface (standard .NET validation), and can be shared between the entities and the builders
- Default values on the model properties can automatically be set in the constructor of the builders, if you want to
- You can either create entities without interfaces, or interface-based entities (possibly in a different namespace, e.g. MyProject.Core and MyProject.Abstractions)
Dog fooding
I have decided that the models for ClassFramework need to be generated using ClassFramework. To make this possible, I have first generated everything with another framework (called ModelFramework) as a Bootstrap action. After this, I re-generated everything using ClassFramework.
But since version 0.9.1, I stored the generated code, so I could add breaking changes. This means the code generation in the build pipelines has been removed.
Known issues
If you have types with nested or multiple generic arguments, the nullability of those types will not get determined correctly... Try to fix this by creating types for this. E.g. System.Func<System.Object, System.Int32, System.Object?> Just create a delegate for this, and add this to the type mapping.
If you still get errors, you could use the CsharpTypeNameAttribute to decorate your property/field/parameter.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- pauldeen79.CrossCutting.Common (>= 3.12.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on pauldeen79.ClassFramework.Domain:
Package | Downloads |
---|---|
pauldeen79.ClassFramework.Pipelines
Package Description |
|
pauldeen79.ClassFramework.CsharpExpressionCreator
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.17.0 | 137 | 11/17/2024 |
0.16.2 | 178 | 11/10/2024 |
0.16.1 | 149 | 11/6/2024 |
0.16.0 | 109 | 11/6/2024 |
0.15.5 | 136 | 10/31/2024 |
0.15.4 | 134 | 10/30/2024 |
0.15.3 | 164 | 10/18/2024 |
0.15.2 | 139 | 10/17/2024 |
0.15.1 | 131 | 9/22/2024 |
0.15.0 | 170 | 9/21/2024 |
0.14.2 | 164 | 9/11/2024 |
0.14.1 | 269 | 8/20/2024 |
0.14.0 | 157 | 8/19/2024 |
0.13.9 | 137 | 8/3/2024 |
0.13.8 | 101 | 7/28/2024 |
0.13.7 | 185 | 7/6/2024 |
0.13.6 | 211 | 6/9/2024 |
0.13.5 | 136 | 6/9/2024 |
0.13.4 | 130 | 6/9/2024 |
0.13.3 | 174 | 5/25/2024 |
0.13.2 | 179 | 5/20/2024 |
0.13.1 | 196 | 5/18/2024 |
0.13.0 | 155 | 5/17/2024 |
0.12.7 | 171 | 5/9/2024 |
0.12.6 | 125 | 5/9/2024 |
0.12.5 | 184 | 5/8/2024 |
0.12.4 | 168 | 5/7/2024 |
0.12.3 | 159 | 5/7/2024 |
0.12.2 | 110 | 5/3/2024 |
0.12.1 | 144 | 5/2/2024 |
0.12.0 | 127 | 5/1/2024 |
0.11.0 | 222 | 4/19/2024 |
0.10.0 | 186 | 4/16/2024 |
0.9.3 | 212 | 4/12/2024 |
0.9.2 | 170 | 4/9/2024 |
0.9.1 | 167 | 4/7/2024 |
0.9.0 | 182 | 4/6/2024 |
0.8.9 | 164 | 4/5/2024 |
0.8.8 | 145 | 4/5/2024 |
0.8.7 | 159 | 4/5/2024 |
0.8.6 | 155 | 4/4/2024 |
0.8.5 | 153 | 4/3/2024 |
0.8.4 | 165 | 4/3/2024 |
0.8.3 | 154 | 4/3/2024 |
0.8.1 | 172 | 4/2/2024 |
0.8.0 | 208 | 3/23/2024 |
0.7.2 | 177 | 3/22/2024 |
0.7.1 | 164 | 3/22/2024 |
0.7.0 | 182 | 3/20/2024 |
0.6.0 | 172 | 3/17/2024 |
0.5.6 | 197 | 3/15/2024 |
0.5.5 | 187 | 3/15/2024 |
0.5.4 | 181 | 3/14/2024 |
0.5.3 | 182 | 3/14/2024 |
0.5.2 | 175 | 3/14/2024 |
0.5.1 | 177 | 3/13/2024 |
0.4.2 | 233 | 3/8/2024 |
0.4.1 | 191 | 3/8/2024 |
0.4.0 | 189 | 3/8/2024 |
0.3.1 | 200 | 3/5/2024 |
0.3.0 | 191 | 3/5/2024 |
0.2.0 | 216 | 3/4/2024 |
0.1.0 | 195 | 2/25/2024 |