-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIEntity.cs
More file actions
88 lines (75 loc) · 2.76 KB
/
IEntity.cs
File metadata and controls
88 lines (75 loc) · 2.76 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using BeyondNetCode.Shell.Ddd.Rules.Impl;
using BeyondNetCode.Shell.Ddd.Services.Impl;
namespace BeyondNetCode.Shell.Ddd.Interfaces
{
/// <summary>
/// Represents an entity with specific properties and validation rules.
/// </summary>
/// <typeparam name="TEntity">The type of the entity.</typeparam>
/// <typeparam name="TProps">The type of the properties.</typeparam>
public interface IEntity<TEntity, TProps>
where TEntity : class
where TProps : class, IProps
{
/// <summary>
/// Gets the manager for broken rules.
/// </summary>
BrokenRulesManager BrokenRules { get; }
/// <summary>
/// Gets the identifier value object.
/// </summary>
IdValueObject Id { get; }
/// <summary>
/// Gets the properties of the entity.
/// </summary>
TProps Props { get; }
/// <summary>
/// Gets the tracking state manager.
/// </summary>
TrackingStateManager TrackingState { get; }
/// <summary>
/// Gets the validator rule manager.
/// </summary>
ValidatorRuleManager<AbstractRuleValidator<TEntity>> ValidatorRules { get; }
/// <summary>
/// Adds validators to the entity.
/// </summary>
void AddValidators();
/// <summary>
/// Determines whether the specified object is equal to the current object.
/// </summary>
/// <param name="obj">The object to compare with the current object.</param>
/// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
bool Equals(object? obj);
/// <summary>
/// Serves as the default hash function.
/// </summary>
/// <returns>A hash code for the current object.</returns>
int GetHashCode();
/// <summary>
/// Gets a copy of the properties.
/// </summary>
/// <returns>A copy of the properties.</returns>
TProps GetPropsCopy();
/// <summary>
/// Determines whether the entity is valid.
/// </summary>
/// <returns>true if the entity is valid; otherwise, false.</returns>
bool IsValid();
/// <summary>
/// Sets the identifier value object.
/// </summary>
/// <param name="id">The identifier string.</param>
/// <returns>The identifier value object.</returns>
IdValueObject SetId(string id);
/// <summary>
/// Sets the properties of the entity.
/// </summary>
/// <param name="props">The properties to set.</param>
void SetProps(TProps props);
/// <summary>
/// Validates the entity.
/// </summary>
void Validate();
}
}