-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathOrderArbitrarySteps.cs
More file actions
65 lines (52 loc) · 1.42 KB
/
OrderArbitrarySteps.cs
File metadata and controls
65 lines (52 loc) · 1.42 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Non-nullable member is uninitialized
#pragma warning disable CS8618
// ReSharper disable All
// Example from https://youtu.be/qCIr30WxJQw?si=FRALafrpA1zWACA8.
// Implementation with arbitrary steps.
using M31.FluentApi.Attributes;
namespace ExampleProject;
[FluentApi]
public class Order2
{
[FluentMember(0)]
[FluentContinueWith(0)]
public int? Number { get; private set; }
[FluentMember(0, "{Name}")]
[FluentContinueWith(0)]
public DateTime? CreatedOn { get; private set; }
[FluentMember(0, "ShippedTo")]
[FluentContinueWith(0)]
public Address2? ShippingAddress { get; private set; }
[FluentMethod(0)]
private void Build()
{
}
}
[FluentApi]
public class Address2
{
[FluentMember(0, "{Name}")]
[FluentContinueWith(0)]
public string? Street { get; private set; }
[FluentMember(0, "{Name}")]
[FluentContinueWith(0)]
public string? City { get; private set; }
[FluentMember(0, "{Name}")]
[FluentContinueWith(0)]
public string? Zip { get; private set; }
[FluentMember(0, "{Name}")]
[FluentContinueWith(0)]
public string? State { get; private set; }
[FluentMember(0, "{Name}")]
[FluentContinueWith(0)]
public string? Country { get; private set; }
[FluentMethod(0)]
private void Build()
{
Street ??= "N/A";
City ??= "N/A";
Zip ??= "N/A";
State ??= "N/A";
Country ??= "N/A";
}
}