StronglyTypedId 1.0.0-beta01

This is a prerelease version of StronglyTypedId.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package StronglyTypedId --version 1.0.0-beta01                
NuGet\Install-Package StronglyTypedId -Version 1.0.0-beta01                
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="StronglyTypedId" Version="1.0.0-beta01" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add StronglyTypedId --version 1.0.0-beta01                
#r "nuget: StronglyTypedId, 1.0.0-beta01"                
#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 StronglyTypedId as a Cake Addin
#addin nuget:?package=StronglyTypedId&version=1.0.0-beta01&prerelease

// Install StronglyTypedId as a Cake Tool
#tool nuget:?package=StronglyTypedId&version=1.0.0-beta01&prerelease                

A source generator for creating strongly-typed IDs by decorating with a [StronglyTypedId] attribute

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on StronglyTypedId:

Package Downloads
Rocketmakers.Storage

Package Description

Rocketmakers.Storage.Data

Package Description

Arex388.Carmine

A highly opinionated .NET Standard 2.0 library for the Carmine.io API.

EnterpriseIntegration

Framework to develop (work)flows following the enterprise integration pattern and run them with a single app instance or with distributed setup with different queue engines (RabbitMQ,...).

Arex388.DocuSeal

A highly opinionated .NET Standard 2.0 library for the DocuSeal.co API.

GitHub repositories (4)

Showing the top 4 popular GitHub repositories that depend on StronglyTypedId:

Repository Stars
JasperFx/marten
.NET Transactional Document DB and Event Store on PostgreSQL
andrewlock/StronglyTypedId
A Rosyln-powered generator for strongly-typed IDs
CodeMazeBlog/CodeMazeGuides
The main repository for all the Code Maze guides
yanpitangui/dotnet-api-boilerplate
A Dotnet 9.0 WebApi template project. MediatR, Swagger, Mapper, Serilog and more implemented.
Version Downloads Last updated
1.0.0-beta08 315,248 4/25/2024
1.0.0-beta07 161,068 12/14/2023
1.0.0-beta06 1,523,147 2/19/2022
1.0.0-beta05 35,527 11/27/2021
1.0.0-beta04 4,806 11/26/2021
1.0.0-beta03 5,006 11/25/2021
1.0.0-beta02 3,881 8/30/2021
1.0.0-beta01 2,543 8/21/2021
0.2.1 468,473 5/17/2020
0.2.0 4,285 4/29/2020
0.1.2 5,186 6/5/2019

Version 0.x of this library used the helper library CodeGeneration.Roslyn for build-time source generation. In version 1.x this approach has been completely replaced in favour of source generators, as these are explicitly supported in .NET 5+. As part of this change, there were a number of additional features added and breaking changes made.

Breaking Changes

* `StronglyTypedIds` namespace is required. In version 0.x of the library, the `[StronglyTypedId]` attribute was in the global namespace. In version 1.x, the attribute is in the `StronglyTypedIds` namespace, so you must add `namespace StronglyTypedIds;`.
* The properties exposed by `StronglyTypedIds` have changed: there is no longer a `generateJsonConverter` property. Instead, this is infered based on the `StronglyTypedIdConverters` flags provided.
* The `String` backing typed ID will throw if you call the constructor with a `null` value

New Features

* The attributes can now auto-generate additional converter types such as EF Core `ValueConverter` and Dapper `TypeHandler`, as described in [my blog posts](https://andrewlock.net/series/using-strongly-typed-entity-ids-to-avoid-primitive-obsession/). These are optional flags on the `converters` property.
* Made interface implementations (`IEquatable<T>` and `IComparable<T>` currently) optional. This is to potentially support additional interfaces in future versions.
* Added a `NullableString` backing type. Due to the behaviour of `struct`s in c#, the `String` backing type ID _may_ still be null, but you can't explicitly call the constructor with a null value. In contrast, you can do this with the `NullableString` backing type.
* Added a `[StronglyTypedIdDefaults]` attribute to set default values for all `[StronglyTypedId]` attributes in your project. This is useful if you want to customise all the attributes, for example, if you want to generate additional converters by default. You can still override all the properties of a `[StronglyTypedId]` instance.

Bug Fixes

* Some converters had incorrect implementations, such as in ([#26](https://github.com/andrewlock/StronglyTypedId/issues/24)). These have been addressed in version 1.x.
* Better null handling has been added for the `String` backing type, handling issues such as [#32](https://github.com/andrewlock/StronglyTypedId/issues/32).
* The code is marked as auto generated, to avoid errors such as #CS1591 as described in [#27](https://github.com/andrewlock/StronglyTypedId/issues/27)


See https://github.com/andrewlock/StronglyTypedId/blob/master/CHANGELOG.md#v100 for more details.