Len.StronglyTypedId.Generators
1.1.3
See the version list below for details.
dotnet add package Len.StronglyTypedId.Generators --version 1.1.3
NuGet\Install-Package Len.StronglyTypedId.Generators -Version 1.1.3
<PackageReference Include="Len.StronglyTypedId.Generators" Version="1.1.3" />
paket add Len.StronglyTypedId.Generators --version 1.1.3
#r "nuget: Len.StronglyTypedId.Generators, 1.1.3"
// Install Len.StronglyTypedId.Generators as a Cake Addin #addin nuget:?package=Len.StronglyTypedId.Generators&version=1.1.3 // Install Len.StronglyTypedId.Generators as a Cake Tool #tool nuget:?package=Len.StronglyTypedId.Generators&version=1.1.3
StronglyTypedId
A base implementation of strongly typed ids that supports Newtonsoft.Json, System.Text.Json, EntityFramework Core, and Swashbuckle.AspNetCore.
Getting started
- Install the package into your application or library.
Package Manager : Install-Package Len.StronglyTypedId
CLI : dotnet add package Len.StronglyTypedId
- Use record to define a strongly typed id:
[StronglyTypedId]
public partial record struct OrderId(Guid Value);
or
[StronglyTypedId]
public partial record OrderId(Guid Value);
Note: Only the record type is supported and cannot be nested, abstract, or generic.Support for serialization and deserialization of Newtonsoft.Json(version 13.0.0 or above) and System.Text.Json.
EntityFramework Core (version 7.0.0 or above)
Add the converter for a strongly typed id to the configuration of DbContext.
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
base.ConfigureConventions(configurationBuilder);
//...other
StronglyTypedIds.ApplyTo(configurationBuilder);
}
Swashbuckle.AspNetCore
Add the converter for a strongly typed id to the configuration of DbContext.
services.AddSwaggerGen(options =>
{
StronglyTypedIds.ApplyTo(options);
});
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.CodeAnalysis.CSharp.Workspaces (>= 4.5.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Len.StronglyTypedId.Generators:
Package | Downloads |
---|---|
Len.StronglyTypedId
A base implementation of strongly typed ids that supports Newtonsoft.Json, System.Text.Json, EntityFramework Core, and Swashbuckle.AspNetCore. |
GitHub repositories
This package is not used by any popular GitHub repositories.