Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }