Exemplo n.º 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);
 }
Exemplo n.º 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();
        }
Exemplo n.º 3
0
 protected virtual void Initialize()
 {
     FullName = new PropHistory <string>((value, _) =>
     {
         if (string.IsNullOrEmpty(value))
         {
             throw new HistoryViolationException("An empty full name.");
         }
     });
 }
Exemplo n.º 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();
        }
Exemplo n.º 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.");
 }