-
Notifications
You must be signed in to change notification settings - Fork 0
/
Person.cs
66 lines (59 loc) · 2.41 KB
/
Person.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
namespace TransferDataBetweenLayersBenchmark;
/// <summary>Domain Entity </summary>
public sealed class Person
{
public int Id { get; set; }
public string FirstName { get; set; } = null!;
public string LastName { get; set; } = null!;
public DateOnly? Birthdate { get; set; }
public bool? Gender { get; set; } // 0 = Female, 1 = Male
public string Email { get; set; } = null!;
public int Score { get; set; }
}
/// <summary>WEB Response создаваемый путём копирования</summary>
public sealed class PersonResponse
{
public int Id { get; set; }
public string FirstName { get; set; } = null!;
public string LastName { get; set; } = null!;
public DateOnly? Birthdate { get; set; }
public bool? Gender { get; set; } // 0 = Female, 1 = Male
public string Email { get; set; } = null!;
public int Score { get; set; }
}
/// <summary>WEB Response создаваемый путём агрегации</summary>
/// <param name="person">источник данных</param>
public sealed class PersonResponseWrapper(Person person)
{
public int Id => person.Id;
public string FirstName => person.FirstName;
public string LastName => person.LastName;
public DateOnly? Birthdate => person.Birthdate;
public bool? Gender => person.Gender;
public string Email => person.Email;
public int Score => person.Score;
}
/// <summary>WEB Response в виде структуры создаваемый путём агрегации</summary>
/// <param name="person">источник данных</param>
public readonly struct PersonResponseWrapperStruct(Person person)
{
public int Id => person.Id;
public string FirstName => person.FirstName;
public string LastName => person.LastName;
public DateOnly? Birthdate => person.Birthdate;
public bool? Gender => person.Gender;
public string Email => person.Email;
public int Score => person.Score;
}
public readonly struct ContainerPersonResponse(IEnumerable<PersonResponse> source)
{
public IEnumerable<PersonResponse> Persons => source;
}
public readonly struct ContainerPersonResponseWrapper(IEnumerable<PersonResponseWrapper> source)
{
public IEnumerable<PersonResponseWrapper> Persons => source;
}
public readonly struct ContainerPersonResponseWrapperStruct(IEnumerable<PersonResponseWrapperStruct> source)
{
public IEnumerable<PersonResponseWrapperStruct> Persons => source;
}