amadevus - Amadevus.RecordGenerator 0.1.1-master-build00028
Analyzers and CodeFixes that generate code for [Record]-marked types: constructors and mutators, in separate partial file. See project site for more details.
PM> Install-Package Amadevus.RecordGenerator -Version 0.1.1-master-build00028 -Source https://www.myget.org/F/amadevus/api/v3/index.json
> nuget.exe install Amadevus.RecordGenerator -Version 0.1.1-master-build00028 -Source https://www.myget.org/F/amadevus/api/v3/index.json
> dotnet add package Amadevus.RecordGenerator --version 0.1.1-master-build00028 --source https://www.myget.org/F/amadevus/api/v3/index.json
<PackageReference Include="Amadevus.RecordGenerator" Version="0.1.1-master-build00028" />
Copy to clipboard
source https://www.myget.org/F/amadevus/api/v3/index.json
nuget Amadevus.RecordGenerator ~> 0.1.1-master-build00028
Copy to clipboard
> choco install Amadevus.RecordGenerator --version 0.1.1-master-build00028 --source https://www.myget.org/F/amadevus/api/v2
Import-Module PowerShellGet
Register-PSRepository -Name "amadevus" -SourceLocation "https://www.myget.org/F/amadevus/api/v2"
Install-Module -Name "Amadevus.RecordGenerator" -RequiredVersion "0.1.1-master-build00028" -Repository "amadevus" -AllowPreRelease
Copy to clipboard
Amadevus.RecordGenerator
ℹ This is for v0.6 of RecordGenerator.
Documentation available at amis92.github.io/RecordGenerator (or in docs folder).
Description
C# Record Generator makes creating immutable record types a breeze! Just adorn your data class with [Record]
attribute
and keep your code clean and simple. The backing code is generated on build-time, including IntelliSense support
(just save the file, Visual Studio will make a build in background).
Demo
Installation, usage, examples and all other docs available at amis92.github.io/RecordGenerator
using System;
using Amadevus.RecordGenerator;
namespace QuickDemo
{
[Record(Features.Default | Features.Equality)]
public sealed partial class Contact
{
public int Id { get; }
public string Name { get; }
public string Email { get; }
public DateTime? Birthday { get; }
}
public static class Program
{
public static void Main()
{
var adam = new Contact.Builder
{
Id = 1,
Name = "Adam Demo",
Email = "foo@bar.com"
}.ToImmutable();
var adamWithBday = adam.WithBirthday(DateTime.UtcNow);
Console.WriteLine("Pretty display: " + adamWithBday);
// Pretty display: { Id = 1, Name = Adam Demo, Email = foo@bar.com, Birthday = 06.01.2020 23:17:06 }
Console.WriteLine("Check equality: " + adam.Equals(adamWithBday));
// Check equality: False
Console.WriteLine("Check equality: " + adam.Equals(new Contact(1, "Adam Demo", "foo@bar.com", null)));
// Check equality: True
}
}
}
The above is taken from QuickDemo sample
Development
To build the solution, .NET Core SDK v3.1.100 is required, as specified in global.json
.
Credits
Amadevus.RecordGenerator
wouldn't work if not for @AArnott AArnott's CodeGeneration.Roslyn.
Analyzers in Amadevus.RecordGenerator.Analyzers
were inspired by xUnit.net's analyzers.
Contributions
All contributions are welcome, as well as critique. If you have any issues, problems or suggestions - please open an issue.
Visual Studio logo ™ Microsoft Corporation, used without permission.
RecordGenerator logo (on top) © 2017 Amadeusz Sadowski, all rights reserved.
Initial release with support for constructor and With-mutators. (Fixed layout to match analyzer requirements)
OwnersAmadeusz Sadowski |
AuthorsAmadeusz Sadowski |
Project URLhttps://github.com/amis92/RecordGenerator |
LicenseMIT |
TagsAmadevus RecordGenerator analyzers codefix record constructor mutator generator |
Info480 total downloads |
6 downloads for version 0.1.1-master-build00028 |
Download (52.04 KB) |
Found on the current feed only |
Package history
Version | Size | Last updated | Downloads | Mirrored? | |||
---|---|---|---|---|---|---|---|
0.7.0-alpha.1 | 3.83 KB | Wed, 08 Apr 2020 13:27:50 GMT | 8 | ||||
0.6.1 | 3.82 KB | Wed, 08 Apr 2020 13:19:22 GMT | 7 | ||||
0.6.0 | 3.82 KB | Wed, 08 Apr 2020 12:31:04 GMT | 24 | ||||
0.6.0-alpha.6 | 3.83 KB | Wed, 08 Apr 2020 12:25:43 GMT | 24 | ||||
0.6.0-alpha.5 | 3.83 KB | Wed, 08 Apr 2020 12:01:19 GMT | 23 | ||||
0.6.0-alpha.4 | 3.83 KB | Wed, 08 Apr 2020 11:40:46 GMT | 25 | ||||
0.6.0-alpha.3 | 3.78 KB | Mon, 30 Mar 2020 21:38:41 GMT | 25 | ||||
0.6.0-alpha.2 | 3.78 KB | Mon, 30 Mar 2020 18:03:47 GMT | 24 | ||||
0.6.0-alpha.1 | 3.77 KB | Mon, 30 Mar 2020 16:40:08 GMT | 25 | ||||
0.5.0 | 3.76 KB | Mon, 30 Mar 2020 15:52:40 GMT | 7 | ||||
0.5.0-preview.3 | 3.78 KB | Mon, 30 Mar 2020 15:13:37 GMT | 8 | ||||
0.5.0-preview.2 | 3.78 KB | Tue, 07 Jan 2020 00:09:27 GMT | 25 | ||||
0.5.0-preview.1 | 3.78 KB | Mon, 06 Jan 2020 20:11:06 GMT | 27 | ||||
0.5.0-beta.12 | 3.77 KB | Mon, 06 Jan 2020 19:47:38 GMT | 7 | ||||
0.5.0-beta.11 | 2.39 KB | Mon, 06 Jan 2020 17:58:03 GMT | 6 | ||||
0.5.0-beta.10 | 2.39 KB | Mon, 06 Jan 2020 17:16:01 GMT | 7 | ||||
0.5.0-beta.9 | 2.38 KB | Mon, 06 Jan 2020 16:31:31 GMT | 24 | ||||
0.5.0-beta.8 | 2.38 KB | Mon, 06 Jan 2020 15:53:09 GMT | 24 | ||||
0.5.0-beta.7 | 2.38 KB | Mon, 06 Jan 2020 15:40:26 GMT | 25 | ||||
0.5.0-beta.6 | 2.38 KB | Mon, 06 Jan 2020 14:05:28 GMT | 27 | ||||
0.5.0-beta.5 | 2.38 KB | Mon, 06 Jan 2020 13:19:02 GMT | 8 | ||||
0.5.0-beta.4 | 2.38 KB | Mon, 06 Jan 2020 12:56:41 GMT | 7 | ||||
0.5.0-beta.3 | 2.38 KB | Fri, 30 Aug 2019 17:32:39 GMT | 27 | ||||
0.5.0-alpha.34 | 2.43 KB | Fri, 30 Aug 2019 13:56:37 GMT | 25 | ||||
0.5.0-alpha.30 | 2.43 KB | Thu, 22 Aug 2019 12:38:03 GMT | 8 | ||||
0.2.0-alpha-build00036 | 22.93 KB | Tue, 19 Sep 2017 16:26:10 GMT | 6 | ||||
0.2.0-alpha-build00035 | 22.92 KB | Tue, 19 Sep 2017 15:44:09 GMT | 6 | ||||
0.2.0-alpha-build00034 | 52.15 KB | Tue, 19 Sep 2017 15:40:44 GMT | 6 | ||||
0.2.0-alpha-build00033 | 52.15 KB | Tue, 19 Sep 2017 14:03:02 GMT | 9 | ||||
0.1.1-master-build00028 | 52.04 KB | Fri, 14 Apr 2017 21:59:26 GMT | 6 |