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
@@ -34,14 +37,20 @@ With `AltaSoft.DomainPrimitives`, experience an accelerated development process
34
37
35
38
The **AltaSoft.DomainPrimitives.Generator** offers a diverse set of features:
36
39
37
-
***Implicit Operators:** Streamlines type conversion to/from the underlying primitive type. [Example](#implicit-usage-of-domaintype)
40
+
***Implicit Operators:** Streamlines type conversion to/from the underlying primitive type, including nullable conversions. [Example](#implicit-usage-of-domaintype)
41
+
***Enhanced Date/Time Conversions:**`DateOnly` and `TimeOnly` domain primitives include additional implicit conversion operators to/from `DateTime` for seamless interoperability.
38
42
***Specialized Constructor Generation:** Automatically validates and constructs instances of this domain type. This constructor, tailored for the domain primitive, utilizes the underlying type as a parameter, ensuring the value's correctness within the domain.
39
43
***TryCreate method:** Introduces a TryCreate method that attempts to create an instance of the domain type and returns a bool indicating the success or failure of the creation process, along with any validation errors.
40
-
***JsonConverters:** Handles JSON serialization and deserialization for the underlying type. [Example](#json-conversion)
44
+
***JsonConverters:** Handles JSON serialization and deserialization for the underlying type, including property name serialization support. [Example](#json-conversion)
41
45
***TypeConverters:** Assists in type conversion to/from it's underlying type. [Please refer to generated type converter below](#type-converter)
42
-
***Swagger Custom Type Mappings:** Facilitates easy integration with Swagger by treating the primitive type as it's underlying type. [Please refer to generated swagger helper below](#swagger-mappers)
***NumberType Operations:** Automatically generates basic arithmetic and comparison operators, by implementing Static abstract interfaces. [More details regarding numeric types](#number-types-attribute)
46
+
***Swagger Custom Type Mappings:** Facilitates easy integration with Swagger by treating the primitive type as it's underlying type, with full nullable support. [Please refer to generated swagger helper below](#swagger-mappers)
47
+
***Interface Implementations:** All DomainPrimitives implement comprehensive interfaces for full framework integration:
48
+
-`IEquatable<T>`, `IComparable`, `IComparable<T>` for equality and comparison operations
49
+
-`IConvertible` for type conversion support
50
+
-`IParsable<T>` for parsing from strings
51
+
-`ISpanFormattable` and `IUtf8SpanFormattable` (NET8+) for efficient formatting
52
+
- Numeric types implement `IAdditionOperators<T>`, `ISubtractionOperators<T>`, etc. as appropriate
53
+
***NumberType Operations:** Automatically generates basic arithmetic and comparison operators, by implementing Static abstract interfaces. [More details regarding numeric types](#managing-generated-operators-for-numeric-types)
45
54
***IParsable Implementation:** Automatically generates parsing for non-string types.
46
55
***XML Serialiaziton** Generates IXmlSerializable interface implementation, to serialize and deserialize from/to xml.
47
56
***EntityFrameworkCore ValueConverters** Facilitates seamless integration with EntityFrameworkCore by using ValueConverters to treat the primitive type as its underlying type. For more details, refer to [EntityFrameworkCore ValueConverters](EntityFrameworkCoreExample.md)
@@ -51,8 +60,8 @@ The **AltaSoft.DomainPrimitives.Generator** offers a diverse set of features:
51
60
2.`Guid`
52
61
3.`byte`
53
62
4.`sbyte`
54
-
5.`short`
55
-
6.`ushort`
63
+
5.`short` (Int16)
64
+
6.`ushort` (UInt16)
56
65
7.`int`
57
66
8.`uint`
58
67
9.`long`
@@ -68,6 +77,31 @@ The **AltaSoft.DomainPrimitives.Generator** offers a diverse set of features:
68
77
19.`DateOnly`
69
78
20.`TimeOnly`
70
79
80
+
### Example Primitive Types
81
+
82
+
You can create domain primitive types for any supported underlying type. Here are some examples:
Mathematical operators for particular numeric types can be customized using the `SupportedOperationsAttribute`. If leftunspecified, alloperatorsaregeneratedbydefault (asshownbelow). Oncethisattributeisapplied, manualspecificationoftheoperatorsbecomesmandatory. Notethatfor `byte`, `sbyte`, `short`, and `ushort` types, mathematicaloperatorswillnotbegeneratedbydefault.
0 commit comments