-
Notifications
You must be signed in to change notification settings - Fork 6
/
Order.cs
43 lines (32 loc) · 1017 Bytes
/
Order.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Non-nullable member is uninitialized
#pragma warning disable CS8618
// ReSharper disable All
// Example from https://youtu.be/qCIr30WxJQw?si=FRALafrpA1zWACA8.
// Implementation with forced steps.
using M31.FluentApi.Attributes;
namespace ExampleProject;
[FluentApi]
public class Order
{
[FluentMember(0)]
public int Number { get; private set; }
[FluentMember(1, "{Name}")]
public DateTime CreatedOn { get; private set; }
[FluentMember(2, "ShippedTo")]
public Address ShippingAddress { get; private set; }
}
[FluentApi]
public class Address
{
[FluentMember(0, "{Name}")]
public string Street { get; private set; }
[FluentMember(1, "{Name}")]
public string City { get; private set; }
[FluentMember(2, "{Name}")]
public string Zip { get; private set; }
[FluentMember(3, "{Name}")]
[FluentDefault("Default{Name}")]
public string State { get; private set; } = "N/A";
[FluentMember(4, "{Name}")]
public string Country { get; private set; }
}