예제 #1
0
 public References(Member source)
 {
     Initialize(source);
     ChildrenIds = new HashSet <Guid>();
     PartnerId   = new PropHistory <Guid?>().AddChange(null, Source.BirthDate);
     Partner.AddChange(null, Source.BirthDate);
 }
예제 #2
0
        public Human(string birthFullName, DateTime birthDate)
        {
            Initialize();

            SetBirthDate(birthDate);
            Status = new PropHistory <StatusOptions>().AddChange(StatusOptions.Unmarried, BirthDate);
            FullName.AddChange(birthFullName, BirthDate);
            Id = Guid.NewGuid();
        }
예제 #3
0
 protected virtual void Initialize()
 {
     FullName = new PropHistory <string>((value, _) =>
     {
         if (string.IsNullOrEmpty(value))
         {
             throw new HistoryViolationException("An empty full name.");
         }
     });
 }
예제 #4
0
        protected override void Initialize()
        {
            Status = new PropHistory <StatusOptions>((value, since) =>
            {
                if (value == StatusOptions.Married && !HadPartner(since))
                {
                    throw new HistoryViolationException("Trying to get married with no partner.");
                }
            });

            base.Initialize();
        }
예제 #5
0
 protected void Initialize(Member source)
 {
     Partner  = new PropHistory <Member>();
     Children = new Dictionary <Guid, Member>();
     Source   = source ?? throw new NullReferenceException("Trying to set null source.");
 }