NetEscapades.EnumGenerators 1.0.0-beta01

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

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

A source generator for creating helper extension methods on enums using a [EnumExtensions] attribute

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on NetEscapades.EnumGenerators:

Package Downloads
DSharpPlus

A C# API for Discord based off DiscordSharp, but rewritten to fit the API standards.

Indrivo.FileStorage.Accessor.Contracts

Package Description

BVP.Common.NET

Most important reusable code for BVP

apex.net-Entities

Models for apex.net

FileStorage.Accessor.Contracts

Package Description

GitHub repositories (3)

Showing the top 3 popular GitHub repositories that depend on NetEscapades.EnumGenerators:

Repository Stars
DSharpPlus/DSharpPlus
A .NET library for making bots using the Discord API.
Nexus-Mods/NexusMods.App
Home of the development of the Nexus Mods App
andrewlock/NetEscapades.EnumGenerators
A source generator for generating fast "reflection" methods for enums
Version Downloads Last updated
1.0.0-beta11 18,541 10/24/2024
1.0.0-beta09 101,682 5/15/2024
1.0.0-beta08 170,288 6/5/2023
1.0.0-beta07 77,828 3/10/2023
1.0.0-beta06 29,693 12/20/2022
1.0.0-beta05 262 12/19/2022
1.0.0-beta04 144,030 11/30/2021
1.0.0-beta03 1,908 11/26/2021
1.0.0-beta02 190 11/22/2021
1.0.0-beta01 388 11/18/2021

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/NetEscapades.EnumGenerators/blob/master/CHANGELOG.md#v100 for more details.