Пример #1
0
        public static CasePlanAggregate New(string casePlanId, string name, string description, string caseOwner, string caseFileId, int caseFileVersion, string xmlContent, ICollection <CasePlanRole> roles, ICollection <CasePlanFileItem> files)
        {
            var result = new CasePlanAggregate();
            var evt    = new CasePlanAddedEvent(Guid.NewGuid().ToString(), BuildCasePlanIdentifier(casePlanId, caseFileVersion), caseFileVersion, casePlanId, name, description, caseOwner, caseFileId, DateTime.UtcNow, xmlContent, roles, files);

            result.Handle(evt);
            result.DomainEvents.Add(evt);
            return(result);
        }
 private void Handle(CasePlanAddedEvent evt)
 {
     AggregateId    = evt.AggregateId;
     Version        = evt.Version;
     CasePlanId     = evt.CasePlanId;
     Name           = evt.Name;
     Description    = evt.Description;
     CaseFileId     = evt.CaseFileId;
     CreateDateTime = evt.CreateDateTime;
     XmlContent     = evt.XmlContent;
     Roles          = evt.Roles.ToList();
     Files          = evt.Files;
 }