-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAddress.cs
33 lines (30 loc) · 1.18 KB
/
Address.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
namespace Ordering.Domain.ValueObjects;
public record Address
{
public string FirstName { get; } = default!;
public string LastName { get; } = default!;
public string? EmailAddress { get; } = default!;
public string AddressLine { get; } = default!;
public string Country { get; } = default!;
public string State { get; } = default!;
public string ZipCode { get; } = default!;
protected Address()
{
}
private Address(string firstName, string lastName, string emailAddress, string addressLine, string country, string state, string zipCode)
{
FirstName = firstName;
LastName = lastName;
EmailAddress = emailAddress;
AddressLine = addressLine;
Country = country;
State = state;
ZipCode = zipCode;
}
public static Address Of(string firstName, string lastName, string emailAddress, string addressLine, string country, string state, string zipCode)
{
ArgumentException.ThrowIfNullOrWhiteSpace(emailAddress);
ArgumentException.ThrowIfNullOrWhiteSpace(addressLine);
return new Address(firstName, lastName, emailAddress, addressLine, country, state, zipCode);
}
}