Skip to content

Commit 2ca598e

Browse files
Copilottemonk
andcommitted
docs: sync docs/ and examples/ with README
Co-authored-by: temonk <47372530+temonk@users.noreply.github.com>
1 parent 063979f commit 2ca598e

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
- [Prerequisites](#prerequisites)
1414
- [Installation](#installation)
1515
- [Creating your Domain type](#creating-your-domain-type)
16+
- [Managing Generated Operators for numeric types](#managing-generated-operators-for-numeric-types)
17+
- [Managing Serialization Format for date-related types](#managing-serialization-format-for-date-related-types)
18+
- [Enhanced DateTime Interoperability](#enhanced-datetime-interoperability)
1619
- [Json Conversion](#json-conversion)
1720
- [Transform Method](#transform-method)
1821
- [Contributions](#contributions)
@@ -41,7 +44,12 @@ The **AltaSoft.DomainPrimitives.Generator** offers a diverse set of features:
4144
* **JsonConverters:** Handles JSON serialization and deserialization for the underlying type, including property name serialization support. [Example](#json-conversion)
4245
* **TypeConverters:** Assists in type conversion to/from it's underlying type. [Please refer to generated type converter below](#type-converter)
4346
* **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)
44-
* **Interface Implementations:** All DomainPritmitives Implement `IConvertible`, `IComparable`, `IComparable<T>`, `IEquatable<T>`, `IEqualityComparer<T>`, `IParsable` interfaces.
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
4553
* **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)
4654
* **IParsable Implementation:** Automatically generates parsing for non-string types.
4755
* **XML Serialiaziton** Generates IXmlSerializable interface implementation, to serialize and deserialize from/to xml.
@@ -69,6 +77,31 @@ The **AltaSoft.DomainPrimitives.Generator** offers a diverse set of features:
6977
19. `DateOnly`
7078
20. `TimeOnly`
7179

80+
### Example Primitive Types
81+
82+
You can create domain primitive types for any supported underlying type. Here are some examples:
83+
84+
```csharp
85+
// String-based primitives
86+
public readonly partial struct EmailAddress : IDomainValue<string> { /* validation */ }
87+
public readonly partial struct ProductCode : IDomainValue<string> { /* validation */ }
88+
89+
// Numeric primitives
90+
public readonly partial struct Age : IDomainValue<int> { /* validation */ }
91+
public readonly partial struct Price : IDomainValue<decimal> { /* validation */ }
92+
public readonly partial struct Weight : IDomainValue<double> { /* validation */ }
93+
public readonly partial struct Score : IDomainValue<float> { /* validation */ }
94+
95+
// Date/Time primitives
96+
public readonly partial struct BirthDate : IDomainValue<DateOnly> { /* validation */ }
97+
public readonly partial struct BusinessHours : IDomainValue<TimeOnly> { /* validation */ }
98+
public readonly partial struct CreatedAt : IDomainValue<DateTime> { /* validation */ }
99+
100+
// Identifier primitives
101+
public readonly partial struct CustomerId : IDomainValue<Guid> { /* validation */ }
102+
public readonly partial struct OrderNumber : IDomainValue<long> { /* validation */ }
103+
```
104+
72105

73106
## Getting Started
74107

0 commit comments

Comments
 (0)