Example #1
0
        public UploadDocumentCommandHandler(ILogger <UploadDocumentCommandHandler> logger,
                                            IAggregateRepository <SIOStoreDbContext> aggregateRepository,
                                            IAggregateFactory aggregateFactory,
                                            IFileClient fileClient)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (aggregateRepository == null)
            {
                throw new ArgumentNullException(nameof(aggregateRepository));
            }
            if (aggregateFactory == null)
            {
                throw new ArgumentNullException(nameof(aggregateFactory));
            }
            if (fileClient == null)
            {
                throw new ArgumentNullException(nameof(fileClient));
            }

            _logger = logger;
            _aggregateRepository = aggregateRepository;
            _aggregateFactory    = aggregateFactory;
            _fileClient          = fileClient;
        }
Example #2
0
 public AddressController(IRepository <Address, Guid> addressRepository, IAddressDataProvider addressDataProvider, IAggregateFactory <Address, AddressFactoryInput, Guid> addressFactory, IMeterReadDataProvider meterReadDataProvider)
 {
     _addressRepository     = addressRepository;
     _addressDataProvider   = addressDataProvider;
     _addressFactory        = addressFactory;
     _meterReadDataProvider = meterReadDataProvider;
 }
Example #3
0
 public AkkaNinjectDependencyResolver(IKernel kernel, ActorSystem system)
     : base(kernel)
 {
     RawAkkaNinjectDependencyResolver = new global::Akka.DI.Ninject.NinjectDependencyResolver(kernel, AkkaSystem = system);
     AkkaActors       = new ConcurrentDictionary <Type, IActorRef>();
     AggregateFactory = Resolve <IAggregateFactory>();
 }
Example #4
0
        public ProductRepository(IAggregateFactory aggregateFactory)
        {
            _client  = new ElasticClient();
            _factory = aggregateFactory;

            Mapper.CreateMap <Product, ProductDTO>();
        }
Example #5
0
 public StatelessLocalCommandHandler(IAggregateFactory factory, IEventStore eventStore,
                                     ISnapshotStore snapshotStore)
 {
     _factory       = factory;
     _snapshotStore = snapshotStore;
     _eventStore    = eventStore;
 }
 public LiteDbAggregateRepository(
     IAggregateFactory factory,
     IEventPublisher publishEndpoint,
     ILiteDatabase liteDb) : base(factory, publishEndpoint)
 {
     LiteDb = liteDb ?? throw new System.ArgumentNullException(nameof(liteDb));
 }
Example #7
0
		public ProductRepository(IAggregateFactory aggregateFactory)
		{
			_client = new ElasticClient();
			_factory = aggregateFactory;

			Mapper.CreateMap<Product, ProductDTO>();
		}
Example #8
0
        public Repository(IAggregateFactory factory, IEventStore eventStore)
        {
            _factory    = factory ?? throw new ArgumentNullException(nameof(factory));
            _eventStore = eventStore ?? throw new ArgumentNullException(nameof(eventStore));

            MementoStore = NullMementoStore.Instance;
        }
Example #9
0
        public LoginCommandHandler(UserManager <SIOUser> userManager,
                                   SignInManager <SIOUser> signInManager,
                                   IAggregateRepository <SIOStoreDbContext> aggregateRepository,
                                   IAggregateFactory aggregateFactory,
                                   ILogger <LoginCommandHandler> logger)
        {
            if (userManager == null)
            {
                throw new ArgumentNullException(nameof(userManager));
            }
            if (signInManager == null)
            {
                throw new ArgumentNullException(nameof(signInManager));
            }
            if (aggregateRepository == null)
            {
                throw new ArgumentNullException(nameof(aggregateRepository));
            }
            if (aggregateFactory == null)
            {
                throw new ArgumentNullException(nameof(aggregateFactory));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _userManager         = userManager;
            _signInManager       = signInManager;
            _aggregateRepository = aggregateRepository;
            _aggregateFactory    = aggregateFactory;
            _logger = logger;
        }
 public AggregateDependencies(IAggregateFactory <TAggregate> factory = null)
 {
     if (factory != null)
     {
         AggregateFactory = factory;
     }
 }
Example #11
0
 protected SqlServerAggregateRepository(EventStoreContext dbContext, IDocumentSerializer serializer,
                                        IAggregateFactory aggregateFactory)
 {
     _dbContext        = dbContext;
     _aggregateFactory = aggregateFactory;
     _serializer       = serializer;
 }
Example #12
0
 public Repository(IAggregateFactory aggregateFactory, IEventStore <TAuthenticationToken> eventStore, IEventPublisher <TAuthenticationToken> publisher, ICorrelationIdHelper correlationIdHelper)
 {
     EventStore          = eventStore;
     Publisher           = publisher;
     CorrelationIdHelper = correlationIdHelper;
     AggregateFactory    = aggregateFactory;
 }
Example #13
0
 protected internal Repository(Builder builder)
 {
     storage_            = builder.EventStorage;
     serialzer_          = builder.EventSerializer;
     aggregate_factory_  = builder.AggregateFactory;
     conflict_evaluator_ = builder.ConflictEvaluator;
 }
 public RentController(IRepository <Rent, Guid> rentRepository,
                       IAggregateFactory <Rent, RentFactoryInput, Guid> rentAggregateFactory, RentAssignDomainService rentAssignDomainService)
 {
     _rentRepository          = rentRepository;
     _rentAggregateFactory    = rentAggregateFactory;
     _rentAssignDomainService = rentAssignDomainService;
 }
Example #15
0
 public EventStoreRepository(IAggregateFactory factory, IEventStoreConnection connection,
                             IOptionsMonitor <EventStoreSettings> settings)
 {
     _factory    = factory;
     _connection = connection;
     _settings   = settings.CurrentValue;
 }
Example #16
0
        public FilesEventStore(
            ILog log,
            IAggregateFactory aggregateFactory,
            IEventJsonSerializer eventJsonSerializer,
            IEnumerable <IMetadataProvider> metadataProviders,
            IEventUpgradeManager eventUpgradeManager,
            IJsonSerializer jsonSerializer,
            IFilesEventStoreConfiguration configuration)
            : base(log, aggregateFactory, eventJsonSerializer, eventUpgradeManager, metadataProviders)
        {
            _jsonSerializer = jsonSerializer;
            _configuration  = configuration;
            _logFilePath    = Path.Combine(_configuration.StorePath, "Log.store");

            if (File.Exists(_logFilePath))
            {
                var json          = File.ReadAllText(_logFilePath);
                var eventStoreLog = _jsonSerializer.Deserialize <EventStoreLog>(json);
                _globalSequenceNumber = eventStoreLog.GlobalSequenceNumber;
                _log = eventStoreLog.Log ?? new Dictionary <long, string>();

                if (_log.Count != _globalSequenceNumber)
                {
                    eventStoreLog         = RecreateEventStoreLog(_configuration.StorePath);
                    _globalSequenceNumber = eventStoreLog.GlobalSequenceNumber;
                    _log = eventStoreLog.Log;
                }
            }
            else
            {
                _log = new Dictionary <long, string>();
            }
        }
Example #17
0
 public InMemoryEventStore(
     ILog log,
     IAggregateFactory aggregateFactory,
     IEventJsonSerializer eventJsonSerializer,
     IEnumerable <IMetadataProvider> metadataProviders)
     : base(log, aggregateFactory, eventJsonSerializer, metadataProviders)
 {
 }
Example #18
0
 public AggregateSnapshotRespositoryDecorator(IAggregateRepository decorated, IAggregateFactory aggregateFactory, IEventStore eventStore, ISnapshotStore snapshotStore, ISnapshotStrategy snapshotStrategy)
 {
     _decoratedRepository = decorated ?? throw new ArgumentNullException(nameof(decorated));
     _aggregateFactory    = aggregateFactory ?? throw new ArgumentNullException(nameof(aggregateFactory));
     _eventStore          = eventStore ?? throw new ArgumentNullException(nameof(eventStore));
     _snapshotStore       = snapshotStore ?? throw new ArgumentNullException(nameof(snapshotStore));
     _snapshotStrategy    = snapshotStrategy ?? throw new ArgumentNullException(nameof(snapshotStrategy));
 }
Example #19
0
 public SnapshotRepository(ISnapshotStore snapshotStore, ISnapshotStrategy <TAuthenticationToken> snapshotStrategy, IRepository <TAuthenticationToken> repository, IEventStore <TAuthenticationToken> eventStore, IAggregateFactory aggregateFactory)
 {
     SnapshotStore    = snapshotStore;
     SnapshotStrategy = snapshotStrategy;
     Repository       = repository;
     EventStore       = eventStore;
     AggregateFactory = aggregateFactory;
 }
Example #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StateStrategy&lt;TEntity, TId&gt;"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="refuseEngine">The refuse engine.</param>
 /// <param name="maxEvents">The max events.</param>
 protected StateStrategy(IAggregateFactory <TEntity, TId> factory, IRefuseEngine <TEntity, TId> refuseEngine, int maxEvents)
 {
     _refuseEngine = refuseEngine;
     _maxEvents    = maxEvents;
     _factory      = factory;
     _strategies   = new Dictionary <string, Action <AggregateRoot <TEntity, TId> > >();
     ConfigureStrategy();
 }
Example #21
0
 /// <summary>
 /// Instantiates a new instance of <see cref="SagaRepository{TAuthenticationToken}"/>
 /// </summary>
 public SagaRepository(IAggregateFactory sagaFactory, IEventStore <TAuthenticationToken> eventStore, IEventPublisher <TAuthenticationToken> publisher, ICommandPublisher <TAuthenticationToken> commandPublisher, ICorrelationIdHelper correlationIdHelper)
 {
     EventStore          = eventStore;
     Publisher           = publisher;
     CorrelationIdHelper = correlationIdHelper;
     CommandPublisher    = commandPublisher;
     SagaFactory         = sagaFactory;
 }
Example #22
0
 public CommandDispatcher(IServiceLocator serviceLocator, IEventRepo eventRepo,
                          IAggregateFactory <A> aggreageFactory, ILogger log)
 {
     _eventRepo       = eventRepo;
     _serviceLocator  = serviceLocator;
     _aggreageFactory = aggreageFactory;
     _log             = log;
 }
 /// <summary>
 /// Instantiates a new instance of <see cref="AkkaNinjectDependencyResolver"/>
 /// </summary>
 public AkkaNinjectDependencyResolver(IKernel kernel, ActorSystem system)
     : base(kernel)
 {
     RawAkkaNinjectDependencyResolver = new global::Akka.DI.Ninject.NinjectDependencyResolver(kernel, AkkaSystem = system);
     AkkaActors = new ConcurrentDictionary <Type, IActorRef>();
     // ReSharper disable DoNotCallOverridableMethodsInConstructor
     AggregateFactory = Resolve <IAggregateFactory>();
     // ReSharper restore DoNotCallOverridableMethodsInConstructor
 }
 public Repository(
     IAggregateFactory aggregateFactory,
     IEventStore eventStore,
     IEventPublisher eventPublisher)
 {
     _eventStore       = eventStore;
     _aggregateFactory = aggregateFactory;
     _eventPublisher   = eventPublisher;
 }
Example #25
0
        public AggregateRepository(
            IEventRepository eventRepository,
            IAggregateFactory aggregateFactory,
            ISnapshotEventRepository snapshotEventRepository = null)
        {
            _eventRepository  = eventRepository ?? throw new ArgumentNullException(nameof(eventRepository));
            _aggregateFactory = aggregateFactory ?? throw new ArgumentNullException(nameof(aggregateFactory));

            _snapshotEventRepository = snapshotEventRepository;
        }
        public void WhenConstructedWithNullQuerySerializerShouldThrowArgumentNullException()
        {
            var eventStore = new Mock <IEventStore>().Object;
            IAggregateFactory aggregateFactory = null;

            Action act = () => new EntityFrameworkCore.AggregateRepository(eventStore, aggregateFactory);

            act.Should().Throw <ArgumentNullException>().
            And.ParamName.Should().Be("aggregateFactory");
        }
Example #27
0
 public MsSqlEventStore(
     ILog log,
     IAggregateFactory aggregateFactory,
     IEventJsonSerializer eventJsonSerializer,
     IEnumerable <IMetadataProvider> metadataProviders,
     IMsSqlConnection connection)
     : base(log, aggregateFactory, eventJsonSerializer, metadataProviders)
 {
     _connection = connection;
 }
Example #28
0
 public AggregateStore(IServiceProvider serviceProvider)
 {
     _serviceProvider           = serviceProvider;
     _logger                    = serviceProvider.GetRequiredService <ILogger <AggregateStore> >();
     _eventJsonSerializer       = serviceProvider.GetRequiredService <IEventJsonSerializer>();
     _persistenceFactory        = serviceProvider.GetRequiredService <IPersistenceFactory>();
     _aggregateFactory          = serviceProvider.GetRequiredService <IAggregateFactory>();
     _transientFaultHandler     = serviceProvider.GetRequiredService <ITransientFaultHandler <IOptimisticConcurrencyResilientStrategy> >();
     _cancellationConfiguration = serviceProvider.GetRequiredService <ICancellationConfiguration>();
 }
Example #29
0
 public EvolutionService(IEvolutionRepository mensagemRepository,
                         IAggregateFactory aggregateFactory,
                         IValidatorFactory validationFactory,
                         IEvolutionDapperRepository evolutionDapperRepository)
 {
     _mensagemRepository        = mensagemRepository;
     _aggregateFactory          = aggregateFactory;
     _validationFactory         = validationFactory;
     _evolutionDapperRepository = evolutionDapperRepository;
 }
Example #30
0
 public AggregateStore(
     IAggregateFactory aggregateFactory,
     IEventStore eventStore,
     ISnapshotStore snapshotStore,
     ITransientFaultHandler <IOptimisticConcurrencyRetryStrategy> transientFaultHandler)
 {
     _aggregateFactory      = aggregateFactory;
     _eventStore            = eventStore;
     _snapshotStore         = snapshotStore;
     _transientFaultHandler = transientFaultHandler;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EventStoreRepository" /> class.
 /// </summary>
 /// <param name="eventStoreFactory">The event store factory.</param>
 /// <param name="factory">The factory.</param>
 /// <param name="conflictDetector">The conflict detector.</param>
 /// <param name="unitOfWorkProvider">The unit of work provider.</param>
 public EventStoreRepository(
     IEventStoreFactory eventStoreFactory,
     IAggregateFactory factory,
     IDetectConflicts conflictDetector,
     IUnitOfWorkProvider unitOfWorkProvider)
 {
     _eventStoreFactory  = eventStoreFactory;
     _factory            = factory;
     _conflictDetector   = conflictDetector;
     _unitOfWorkProvider = unitOfWorkProvider;
 }
        public void Setup()
        {
            _repository = new Repository<EntityEventSource<Ship, ObjectId>, ObjectId>("RationalEvs", "EventSourcing");
            _queryBuilder = new MongoQuerySnapshotBuilder<Ship, ObjectId>();
            _eventsRepository = new EventsRepository<Ship, ObjectId>(_repository, _queryBuilder, 0);

            _fsmConfigurator = FsmConfiguratorFactory.WithXgml("shipStateMachine.xgml").SetInitialState("In Navigation").WithDomainAssembly
            <DepartureEvent>("RationalEvs.Test.DomainFake.Events").
            Create();

            _aggregateFactory = new AggregateRootFactory<Ship, ObjectId>(_eventsRepository, _fsmConfigurator)
                                    {
                                        Logger = LogManager.GetLogger(GetType())
                                    };

            _ship = new Ship { Id = ObjectId.GenerateNewId() };
        }