You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library provides some interfaces, classes, [Roslyn Source Generators](https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview), Roslyn Analyzers and Roslyn CodeFixes for implementation of **Smart Enums** and **Value Objects**.
13
13
14
14
See [wiki](https://github.com/PawelGerr/Thinktecture.Runtime.Extensions/wiki) for more documentation.
15
15
16
16
# Required SDK/Compiler Version
17
-
* Compiler version: 4.2.0
17
+
* Compiler version: 4.1.0
18
18
19
19
Verify the version by placing `#error version` into any of your cs-files and build the project/solution.
20
-
The build output should display the compiler version:
20
+
The build output should display the compiler version:
21
21
```
22
22
MyFile.cs(15, 8): [CS1029] #error: 'version'
23
-
MyFile.cs(15, 8): [CS8304] Compiler version: '4.2.0-4.22220.2 (1e40aa11)'. Language version: 10.0.
23
+
MyFile.cs(15, 8): [CS8304] Compiler version: '4.1.0-5.22165.10 (e555772d)'. Language version: 10.0.
24
24
```
25
25
26
26
Update your IDE and SDK to newest version.
27
27
Works/tested with:
28
-
* SDK: 6.0.300
29
-
* Visual Studio: 17.2.0
30
-
* JetBrains Rider: 2022.1.1
28
+
* SDK: 6.0.202
29
+
* Visual Studio: 17.1.5
30
+
* JetBrains Rider: 2022.1
31
31
32
32
> Please note: For developers having both, JetBrains Rider and Visual Studio, please update Visual Studio as well, because Rider is using the SDK of Visual Studio by default.
* Roslyn Analyzers and CodeFixes help the developers to implement the Smart Enums correctly
43
-
* Allows iteration over all items
44
-
* Allows custom properties and methods
45
-
* Provides appropriate constructor based on the specified properties/fields
46
-
* Provides means for lookup, cast and type conversion from key-type to Smart Enum and vice versa
47
-
* Provides proper implementation of `Equals`, `GetHashCode`, `ToString` and equality comparison via `==` and `!=`
48
-
* Choice between always-valid `IEnum<T>` and maybe-valid `IValidatableEnum<T>`
49
-
* Allows extensions of existing Smart Enums
50
-
* Allows custom validation of constructor arguments
51
-
* Allows changing the propery name `Key`, which holds the underlying value - thanks to [Roslyn Source Generator](https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview)
52
-
* Allows custom key comparer
53
-
* JSON support (`System.Text.Json` and `Newtonsoft.Json`)
54
-
* ASP.NET Core support (model binding and model validation)
55
-
* Entity Framework Core support (`ValueConverter`)
56
-
* MessagePack support (`IMessagePackFormatter`)
42
+
* Roslyn Analyzers and CodeFixes help the developers to implement the Smart Enums correctly
43
+
* Allows iteration over all items
44
+
* Allows custom properties and methods
45
+
* Provides appropriate constructor based on the specified properties/fields
46
+
* Provides means for lookup, cast and type conversion from key-type to Smart Enum and vice versa
47
+
* Provides proper implementation of `Equals`, `GetHashCode`, `ToString` and equality comparison via `==` and `!=`
48
+
* Choice between always-valid `IEnum<T>` and maybe-valid `IValidatableEnum<T>`
49
+
* Allows extensions of existing Smart Enums
50
+
* Allows custom validation of constructor arguments
51
+
* Allows changing the propery name `Key`, which holds the underlying value - thanks to [Roslyn Source Generator](https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview)
52
+
* Allows custom key comparer
53
+
* JSON support (`System.Text.Json` and `Newtonsoft.Json`)
54
+
* ASP.NET Core support (model binding and model validation)
55
+
* Entity Framework Core support (`ValueConverter`)
56
+
* MessagePack support (`IMessagePackFormatter`)
57
57
58
58
Definition of a new Smart Enum without any custom properties and methods. All other features mentioned above are generated by the [Roslyn Source Generators](https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview) in the background.
Documentation: [Immutable Value Objects](https://github.com/PawelGerr/Thinktecture.Runtime.Extensions/wiki/Immutable-Value-Objects)
103
103
104
104
Features:
105
-
* Roslyn Analyzers and CodeFixes help the developers to implement the Value Objects correctly
106
-
* Allows custom properties and methods
107
-
* Provides appropriate factory methods for creation of new value objects based on the specified properties/fields
108
-
* Allows custom validation of constructor and factory method arguments
109
-
* Additional features for simple Value Objects (1 "key"-property/field) and complex Value Objects (2 properties/fields or more)
110
-
* Simple Value Objects: allows cast and type conversion from key-type to Value Object and vice versa
111
-
* Simple Value Objects: provides an implementation of `IComparable<T>` if the key-property/field is an `IComparable<T>` or has an `IComparer<T>`
112
-
* Simple Value Objects: provides an implementation of `IFormattable` if the key-property/field is an `IFormattable`
113
-
* Provides proper implementation of `Equals`, `GetHashCode`, `ToString` and equality comparison via `==` and `!=`
114
-
* Allows custom equlity comparison
115
-
* JSON support (`System.Text.Json` and `Newtonsoft.Json`)
116
-
* ASP.NET Core support (model binding and model validation)
117
-
* Entity Framework Core support (`ValueConverter`)
118
-
* MessagePack support (`IMessagePackFormatter`)
105
+
* Roslyn Analyzers and CodeFixes help the developers to implement the Value Objects correctly
106
+
* Allows custom properties and methods
107
+
* Provides appropriate factory methods for creation of new value objects based on the specified properties/fields
108
+
* Allows custom validation of constructor and factory method arguments
109
+
* Additional features for simple Value Objects (1 "key"-property/field) and complex Value Objects (2 properties/fields or more)
110
+
* Simple Value Objects: allows cast and type conversion from key-type to Value Object and vice versa
111
+
* Simple Value Objects: provides an implementation of `IComparable<T>` if the key-property/field is an `IComparable<T>` or has an `IComparer<T>`
112
+
* Simple Value Objects: provides an implementation of `IFormattable` if the key-property/field is an `IFormattable`
113
+
* Provides proper implementation of `Equals`, `GetHashCode`, `ToString` and equality comparison via `==` and `!=`
114
+
* Allows custom equlity comparison
115
+
* JSON support (`System.Text.Json` and `Newtonsoft.Json`)
116
+
* ASP.NET Core support (model binding and model validation)
117
+
* Entity Framework Core support (`ValueConverter`)
118
+
* MessagePack support (`IMessagePackFormatter`)
119
119
120
120
Definition of a value object with 1 custom property `Value`. All other features mentioned above are generated by the [Roslyn Source Generators](https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview) in the background.
Copy file name to clipboardExpand all lines: src/Thinktecture.Runtime.Extensions.SourceGenerator/CodeAnalysis/ValueObjects/ValueObjectSourceGenerator.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
thrownewException($"The '{nameof(context.MetadataReferencesProvider)}' is neither an 'IncrementalValuesProvider<{nameof(MetadataReference)}>' nor an 'IncrementalValueProvider<{nameof(MetadataReference)}>.'");
Copy file name to clipboardExpand all lines: src/Thinktecture.Runtime.Extensions.SourceGenerator/Thinktecture.Runtime.Extensions.SourceGenerator.csproj
Copy file name to clipboardExpand all lines: test/Thinktecture.Runtime.Extensions.SourceGenerator.Tests/Thinktecture.Runtime.Extensions.SourceGenerator.Tests.csproj
0 commit comments