IxSoftware.Generators.IdGenerator 1.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package IxSoftware.Generators.IdGenerator --version 1.1.1                
NuGet\Install-Package IxSoftware.Generators.IdGenerator -Version 1.1.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="IxSoftware.Generators.IdGenerator" Version="1.1.1">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IxSoftware.Generators.IdGenerator --version 1.1.1                
#r "nuget: IxSoftware.Generators.IdGenerator, 1.1.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 IxSoftware.Generators.IdGenerator as a Cake Addin
#addin nuget:?package=IxSoftware.Generators.IdGenerator&version=1.1.1

// Install IxSoftware.Generators.IdGenerator as a Cake Tool
#tool nuget:?package=IxSoftware.Generators.IdGenerator&version=1.1.1                

Id Generator

This project adds a source generator to your project that creates identity types. It's used for types that identifies some resource. For example a user id or application id.

The source generator adds casting operators (explicit cast to, implicit cast from), equality checks, hash code, equals and ToString() (if it is not already provided).

It will get applied to a partial readonly struct that specifies IEquality on itself and has a single private readonly field with no constructors defined. The struct currently must be declared in a namespace, i.e. you cannot declare them as inner types.

Example:

public readonly partial struct UserId : IEquatable<UserId>
{
   private readonly Guid value;
}

This is all you have to write. Notice that this struct would not normally compile, so if it doesn't there's probably something wrong. If you need more than a single field you can use a tuple on the value field. Note that the field doesn't have to be named value.

You can add additional methods or static fields.

Building

This project, or more specifically the test project, requires Visual Studio 16.8 to build and/or the 5.0 (or newer) version of the .NET Core SDK toolchain.

If this is in order the project should build either through Visual Studio or dotnet build. A NuGet package will get built.

License

This program is licensed under the MIT license. Please see license.txt for details.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.0 92 11/24/2024
1.2.3 414 1/13/2023
1.2.2 475 5/11/2021
1.2.1 520 12/19/2020
1.2.0 213 12/5/2020
1.1.1 258 11/10/2020
1.1.0 495 7/9/2020
1.0.0 544 7/8/2020

# 1.1.1
- Fix for release of Visual Studio 2019 16.8 which changed the interface for source generators.
- Removed error messages for old versions of Visual Studio.
# 1.1
- `Equals` for when the type is a string now use ordinal compare rather than culture dependent comparison which is the default
- Small performance and memory improvements
- Added error message if trying to build with an old version of MSBuild or .NET Core toolchain
# 1.0
- First version
- Added IdGenerator