public AnnotationCommandHandlerAdapter(object annotatedCommandHandler, IParameterResolverFactory parameterResolverFactory, IHandlerDefinition handlerDefinition) { Assert.NotNull(annotatedCommandHandler, () => "annotatedCommandHandler may not be null"); _modelInspector = AnnotatedAggregateMetaModelFactory.InspectAggregate(annotatedCommandHandler.GetType(), parameterResolverFactory, handlerDefinition); _target = annotatedCommandHandler; }
public static AnnotatedAggregate <T> Initialize(T aggregateRoot, IAggregateModel aggregateModel, IEventBus eventBus, IRepositoryProvider repositoryProvider) { var aggregate = new AnnotatedAggregate <T>(aggregateRoot, aggregateModel, eventBus, repositoryProvider); aggregate.RegisterWithUnitOfWork(); return(aggregate); }
public EventBase(IAggregateModel model, string eventType, string eventClrType) { TenantId = model.TenantId; Id = model.Id; CreatedDateTimeUtc = DateTime.UtcNow; EventType = eventType; ServerCulture = Thread.CurrentThread.CurrentCulture.Name; _metaData = new Dictionary <string, object>() { { ValueAggregateConstants.EventMetaDataHeaders.AggregateClrTypeHeader, model.GetType().AssemblyQualifiedName }, { ValueAggregateConstants.EventMetaDataHeaders.EventClrTypeHeader, eventClrType }, { ValueAggregateConstants.EventMetaDataHeaders.CommitIdHeader, model.CommitId } }; }
public static AnnotatedAggregate <T> Initialize(Func <T> aggregateFactory, IAggregateModel aggregateModel, IEventBus eventBus, IRepositoryProvider repositoryProvider, bool generateSequences) { var aggregate = new AnnotatedAggregate <T>(aggregateModel, eventBus, repositoryProvider); aggregate.RegisterWithUnitOfWork(); if (generateSequences) { aggregate.InitSequence(); } aggregate.RegisterRoot(aggregateFactory); return(aggregate); }
public AggregateAnnotationCommandHandler(IRepository <T> repository, ICommandTargetResolver commandTargetResolver, IAggregateModel aggregateModel) { if (aggregateModel == null) { throw new ArgumentNullException(nameof(aggregateModel)); } if (repository == null) { throw new ArgumentNullException(nameof(repository)); } if (commandTargetResolver == null) { throw new ArgumentNullException(nameof(commandTargetResolver)); } _repository = repository; _commandTargetResolver = commandTargetResolver; _aggregateModel = aggregateModel; }
protected AbstractRepository(IAggregateModel aggregateModel) { NotNull(aggregateModel, () => "aggregateModel may not be null"); AggregateModel = aggregateModel; }
internal AggregateAdapter(IBoundedContextModel contextMap, TAggregateRoot aggregateRoot) { this.contextMap = contextMap; this.aggregateRoot = aggregateRoot; this.aggregateModel = contextMap.AggregateModel(typeof(TAggregateRoot)); }
public static AnnotatedAggregate <T> Initialize(T aggregateRoot, IAggregateModel aggregateModel, IEventBus eventBus) { return(Initialize(aggregateRoot, aggregateModel, eventBus, null)); }
public static AnnotatedAggregate <T> Initialize(Func <T> aggregateFactory, IAggregateModel aggregateModel, IEventBus eventBus, bool generateSequences) { return(Initialize(aggregateFactory, aggregateModel, eventBus, null, generateSequences)); }
public static AnnotatedAggregate <T> Initialize(Func <T> aggregateFactory, IAggregateModel aggregateModel, IEventBus eventBus, IRepositoryProvider repositoryProvider) { return(Initialize(aggregateFactory, aggregateModel, eventBus, repositoryProvider, false)); }
public static AnnotatedAggregate <T> Initialize(Func <T> aggregateFactory, IAggregateModel aggregateModel, IEventBus eventBus) { return(Initialize(aggregateFactory, aggregateModel, eventBus, false)); }
protected AnnotatedAggregate(IAggregateModel inspector, IEventBus eventBus, IRepositoryProvider repositoryProvider) { _inspector = inspector; _repositoryProvider = repositoryProvider; _eventBus = eventBus; }
protected AnnotatedAggregate(IAggregateModel inspector, IEventBus eventBus) : this(inspector, eventBus, (IRepositoryProvider)null) { }
protected AnnotatedAggregate(T aggregateRoot, IAggregateModel model, IEventBus eventBus, IRepositoryProvider repositoryProvider) : this(model, eventBus, repositoryProvider) { this._aggregateRoot = aggregateRoot; }
protected AnnotatedAggregate(T aggregateRoot, IAggregateModel model, IEventBus eventBus) : this(aggregateRoot, model, eventBus, null) { }
private IReadOnlyDictionary <string, IMessageHandler <ICommandMessage> > InitializeHandlers(IAggregateModel aggregateModel) { var handlersFound = new Dictionary <string, IMessageHandler <ICommandMessage> >(); var aggregateCommandHandler = new AggregateCommandHandler(this); aggregateModel.CommandHandlers.ForEach(kv => { if (kv.Value.Unwrap <ICommandMessageHandlingMember>() .Map(x => x.IsFactoryHandler).OrElse(false)) { handlersFound[kv.Key] = new AggregateConstructorCommandHandler(kv.Value, this); } else { handlersFound[kv.Key] = aggregateCommandHandler; } }); return(handlersFound); }