-
Notifications
You must be signed in to change notification settings - Fork 1
Domain Layer
Enis Ademov edited this page Aug 20, 2023
·
1 revision
public class FriendReferral {
public List<FriendReferralStep> Steps { get; private set; }
public int CurrentProgress { get; set; }
public FriendReferral(
List<FriendReferralStep> steps,
int currentProgress
) {
Steps = steps;
CurrentProgress = currentProgress;
}
}
Rules:
- Entities are mutable;
- Entities do not need to be serializable;
- The entity state should be encapsulated to external access. Usually Repository;
- Entities can contain methods, as long as they are encapsulated;
- Entities can enforce certain business rules;
- Entities can throw domain exceptions.
public interface IFriendReferralRepository {
IObservable<Domain.FriendReferral.FriendReferral> GetFriendReferrals();
Task ClaimFriendReferralBonus();
}
Rules:
- Do no use void for Create/Update/Delete type of operations. Use Task instead, even if it's not async method.