Beispiel #1
0
 public static ClassA CreateNew(CreateClassACommand command,
                                IValidator <CreateClassACommand> validator)
 {
     // You can have validations here too, with help of FluentValidation
     // library
     validator.ValidateAndThrow(command);
     return(new ClassA(command));
 }
Beispiel #2
0
 private ClassA(CreateClassACommand command) : base(command.Id)
 {
     this.Name     = command.Name;
     this.ClassBId = command.ClassBId;
     // You can create events and store them later on as auditing or
     // have others subscribe this event.
     AddEvent(new ClassACreated
     {
         // ...
     });
 }