Len.StronglyTypedId.Generators 1.2.1

dotnet add package Len.StronglyTypedId.Generators --version 1.2.1
NuGet\Install-Package Len.StronglyTypedId.Generators -Version 1.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Len.StronglyTypedId.Generators" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Len.StronglyTypedId.Generators --version 1.2.1
#r "nuget: Len.StronglyTypedId.Generators, 1.2.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Len.StronglyTypedId.Generators as a Cake Addin
#addin nuget:?package=Len.StronglyTypedId.Generators&version=1.2.1

// Install Len.StronglyTypedId.Generators as a Cake Tool
#tool nuget:?package=Len.StronglyTypedId.Generators&version=1.2.1

StronglyTypedId

codecov NuGet

A base implementation of strongly typed ids that supports Newtonsoft.Json, System.Text.Json, EntityFramework Core, and Swashbuckle.AspNetCore.

Getting started

  1. Install the package into your application or library.
    Package Manager : Install-Package Len.StronglyTypedId
    CLI : dotnet add package Len.StronglyTypedId 
  1. 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 Swagger.

    services.AddSwaggerGen(options =>
    {
        StronglyTypedIds.ApplyTo(options);
    });

QA

Question: Why has the analyzer in the library dependent on strongly-typed IDs not generated the latest code?

Answer: It could be due to the Visual Studio cache. Please clean the solution and regenerate it. Alternatively, you can disregard this situation, as the compiled assembly will include the latest code.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last updated
1.2.1 598 2/26/2024
1.2.0 1,184 11/27/2023
1.1.3 1,332 10/8/2023
1.1.2 1,366 10/8/2023
1.1.1 1,605 5/20/2023
1.1.0 1,668 5/18/2023