public ValueCreatedEvent(IValuesRootAggregateDataModel model) : base(model, ValueAggregateConstants.EventTypes.ValueCreated,
                                                                      typeof(ValueCreatedEvent).AssemblyQualifiedName)
 {
     Code  = model.Code;
     Name  = model.Name;
     Value = model.Value;
 }
Beispiel #2
0
 public ValueViewModel ToViewModel(IValuesRootAggregateDataModel aggregate)
 {
     return(new ValueViewModel()
     {
         Id = aggregate.Id,
         TenantId = new DtoProp <int?>(aggregate.TenantId),
         Name = new DtoProp <string>(aggregate.Name),
         Code = new DtoProp <string>(aggregate.Code),
         Value = new DtoProp <string>(aggregate.Value),
         Version = new DtoProp <long?>(aggregate.Version),
         Comments = aggregate.Comments.Select(ToViewModel)
     });
 }
Beispiel #3
0
        public void CreateValue(IValuesRootAggregateDataModel model, bool applyEvent = true)
        {
            // Note: We want to modify the props using there methods, to keep the business logic in one place
            // Also we don't want to fire individual prop changed events when an aggregate is created first time
            // Only one event called ValueCreated will be fired/applied

            ChangeTenantId(model.TenantId);
            ChangeName(model.Name, applyEvent: false);
            ChangeCode(model.Code, applyEvent: false);
            ChangeValue(model.Value, applyEvent: false);

            if (!applyEvent)
            {
                return;
            }

            ApplyEvent(ValueEventType.ValueCreated);
        }
Beispiel #4
0
 public NameChangedEvent(IValuesRootAggregateDataModel model) : base(model, ValueAggregateConstants.EventTypes.NameChanged,
                                                                     typeof(NameChangedEvent).AssemblyQualifiedName)
 {
     Name = model.Name;
 }