/// <summary>
 ///     Initializes a new instance of the <see cref="AsyncRepository{TAggregateRoot}" /> class.
 /// </summary>
 /// <param name="rootFactory">The aggregate root entity factory.</param>
 /// <param name="unitOfWork">The unit of work to interact with.</param>
 /// <param name="connection">The event store connection to use.</param>
 /// <param name="configuration">The event store configuration to use.</param>
 /// <exception cref="System.ArgumentNullException">
 ///     Thrown when the <paramref name="rootFactory" /> or
 ///     <paramref name="unitOfWork" /> or <paramref name="connection" /> or <paramref name="configuration" /> is null.
 /// </exception>
 public AsyncRepository(Func <TAggregateRoot> rootFactory, ConcurrentUnitOfWork unitOfWork,
                        IEventStoreConnection connection, EventReaderConfiguration configuration)
 {
     RootFactory   = rootFactory ?? throw new ArgumentNullException(nameof(rootFactory));
     UnitOfWork    = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork));
     Connection    = connection ?? throw new ArgumentNullException(nameof(connection));
     Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Repository{TAggregateRoot}"/> class.
 /// </summary>
 /// <param name="rootFactory">The aggregate root entity factory.</param>
 /// <param name="unitOfWork">The unit of work to interact with.</param>
 /// <param name="connection">The event store connection to use.</param>
 /// <param name="configuration">The event reader configuration to use.</param>
 /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="rootFactory"/> or <paramref name="unitOfWork"/> or <paramref name="connection"/> or <paramref name="configuration"/> is null.</exception>
 public Repository(Func <TAggregateRoot> rootFactory, UnitOfWork unitOfWork, IEventStoreConnection connection,
                   EventReaderConfiguration configuration)
 {
     if (rootFactory == null)
     {
         throw new ArgumentNullException("rootFactory");
     }
     if (unitOfWork == null)
     {
         throw new ArgumentNullException("unitOfWork");
     }
     if (connection == null)
     {
         throw new ArgumentNullException("connection");
     }
     if (configuration == null)
     {
         throw new ArgumentNullException("configuration");
     }
     _rootFactory   = rootFactory;
     _unitOfWork    = unitOfWork;
     _connection    = connection;
     _configuration = configuration;
 }