public void Setup() { _connectionString = ConfigurationManager.AppSettings["MongoEventStoreConnectionString"]; _database = ConfigurationManager.AppSettings["MongoEventStoreDatabaseName"]; var mockPublisher = MockRepository.GenerateMock<IEventPublisher>(); var eventPersistence = new MongoEventPersistence(_connectionString, _database); _domainRepository = new DomainRepository(new EventStore(eventPersistence, mockPublisher)); }
public void When() { var repositoryFactory = new DomainRepositoryStubFactory(); _blogRepository = repositoryFactory.GetDomainRepository<Blog>(); _blogCommandHandlers = new BlogCommandHandlers(repositoryFactory); _createBlogCommand = new CreateBlogCommand("Title", "SubTitle", Guid.Empty, Guid.Empty); _blogCommandHandlers.Handle(_createBlogCommand); }
public StudentsAppService(IDomainRepository<Student> studentsRepository) { if (studentsRepository == null) { throw new Exception("studentsRepository"); } this._studentsRepository = studentsRepository; }
public CoursesAppService(IDomainRepository<Course> coursesRepository) { if (coursesRepository == null) { throw new ArgumentNullException("coursesRepository"); } this._coursesRepository = coursesRepository; }
public JoesUnitOfWork(Guid commandId, IDomainRepository domainRepository, IStoreEvents eventStore, ISnapshotStore snapshotStore, IEventBus eventBus, ISnapshottingPolicy snapshottingPolicy) : base(commandId) { _eventStream = new UncommittedEventStream(commandId); _commitId = commandId; _eventStore = eventStore; _domainRepository = domainRepository; _snapshotStore = snapshotStore; _eventBus = eventBus; _snapshottingPolicy = snapshottingPolicy; }
public void SetUp() { new DomainDatabaseBootStrapper().ReCreateDatabaseSchema(); var sqliteConnectionString = string.Format("Data Source={0}", dataBaseFile); _domainEventStorage = new DomainEventStorage(sqliteConnectionString, new BinaryFormatter()); _eventStoreIdentityMap = new EventStoreIdentityMap(); _eventStoreUnitOfWork = new EventStoreUnitOfWork(_domainEventStorage, _eventStoreIdentityMap, new Mock<IBus>().Object); _repository = new DomainRepository(_eventStoreUnitOfWork, _eventStoreIdentityMap); }
public UnitOfWork(Guid commandId, IDomainRepository domainRepository, IEventStore eventStore, ISnapshotStore snapshotStore, IEventBus eventBus, ISnapshottingPolicy snapshottingPolicy) : base(commandId) { Contract.Requires<ArgumentNullException>(domainRepository != null); Contract.Requires<ArgumentNullException>(snapshotStore != null); Contract.Requires<ArgumentNullException>(eventStore != null); Contract.Requires<ArgumentNullException>(eventBus != null); Contract.Requires<ArgumentNullException>(snapshottingPolicy != null); _repository = domainRepository; _snapshottingPolicy = snapshottingPolicy; _eventBus = eventBus; _snapshotStore = snapshotStore; _eventStore = eventStore; _eventStream = new UncommittedEventStream(commandId); _dirtyInstances = new Queue<AggregateRoot>(); }
public DomainService( ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IDomainRepository domainRepository) : base(provider, loggerFactory, eventMessagesFactory) =>
public EventSourcingDomainRepositoryTests() { this.repository = new EventSourcingDomainRepository(eventStore, eventPublisher); }
public CreateCategoryCommandHandler(IDomainRepository repository) { _repository = repository; }
public IssuesController(IDomainRepository domainRepository, IUserSession userSession) { _domainRepository = domainRepository; _userSession = userSession; }
public BaseIdentityEventHandler(IIdentityReportDataAccessor reportDataAccessor, ICommandTracker commandTracker, ILogger logger, IDomainRepository domainRepository, IEventPublisher eventPublisher) : base(commandTracker, logger) { _reportDataAccessor = reportDataAccessor; _domainRepository = domainRepository; _eventPublisher = eventPublisher; }
public BaseInventoryCommandHandler(IDomainRepository domainRepository, IInventoryReportDataAccessor dataAccesor, ICommandTracker tracker, ILogger logger) : base(tracker, logger) { _domainRepository = domainRepository; _dataAccessor = dataAccesor; }
/// <summary> /// Initializes a domain context /// </summary> public DomainContext(IEventBus eventBus, IEventStore eventStore, ISnapshotStore snapshotStore, IDomainRepository domainRepository) { _eventStore = eventStore; _eventBus = eventBus; _snapshotStore = snapshotStore; _repository = domainRepository; }
public async Task Given_An_Aggregate_Which_Has_Been_Saved_When_A_Snapshot_Is_Taken_Then_The_Aggregate_Can_Be_Loaded_From_The_Latest_Snapshot_For_Load_From_Latest() { IDomainRepository domainRepository = GetDomainRepository(); await this.Given_An_Aggregate_Which_Has_Been_Saved_When_A_Snapshot_Is_Taken_Then_The_Aggregate_Can_Be_Loaded_From_The_Latest_Snapshot(domainRepository, LoadAggregateAsync(domainRepository)).ConfigureAwait(false); }
public async Task Given_An_Aggregate_With_Two_Events_That_Have_The_Same_Id_When_Saving_A_Snapshot_Then_The_Revision_Should_Be_One_For_Load_From_Latest() { IDomainRepository domainRepository = GetDomainRepository(); await this.Given_An_Aggregate_With_Two_Events_That_Have_The_Same_Id_When_Saving_A_Snapshot_Then_The_Revision_Should_Be_One(domainRepository, LoadAggregateAsync(domainRepository)).ConfigureAwait(false); }
public void Release(IDomainRepository repository) { ServiceLocator.Current.Release(repository); }
public DomainService(IDomainRepository domainRepository) { _domainRepository = domainRepository; }
public AllCommandHandlers(IDomainRepository domainRepository) { _domainRepository = domainRepository; }
public IssuesController(IUserSession userSession, IDomainRepository repository) { _userSession = userSession; _repository = repository; }
public void Release(IDomainRepository repository) { _locator.Release(repository); }
public void SetUp() { sut = new SnapShotService(); bus = MockRepository.GenerateMock<IBus>(); eventConvertor = MockRepository.GenerateMock<IEventConvertor>(); var entityRepository = new InMemoryEntityRepository(); domainRepository = new DomainRepository(new DomainEventStorageService(entityRepository, new DateTimeService()), bus, eventConvertor); }
public async Task Given_An_Aggregate_With_Events_When_A_Snapshot_Is_Taken_Then_The_Number_Of_Events_Since_Last_Snapshot_Count_Is_One_Before_The_Snapshot_And_Zero_After_The_Snapshot_For_Load_From_Latest() { IDomainRepository domainRepository = GetDomainRepository(); await this.Given_An_Aggregate_With_Events_When_A_Snapshot_Is_Taken_Then_The_Number_Of_Events_Since_Last_Snapshot_Count_Is_One_Before_The_Snapshot_And_Zero_After_The_Snapshot(domainRepository).ConfigureAwait(false); }
public ProjectController(ISourceControlManager sourceControlManager, IDomainRepository<Project> projectRepository) { _sourceControlManager = sourceControlManager; _projectRepository = projectRepository; }
public async Task Given_An_Aggregate_With_A_Stream_And_Snapshot_At_The_End_Of_The_Stream_When_The_Aggregate_Is_Loaded_From_The_Snapshot_And_Saved_Then_The_Number_Of_Events_Since_Last_Snapshot_Is_One_For_Load_From_Latest() { IDomainRepository domainRepository = GetDomainRepository(); await this.Given_An_Aggregate_With_A_Stream_And_Snapshot_At_The_End_Of_The_Stream_When_The_Aggregate_Is_Loaded_From_The_Snapshot_And_Saved_Then_The_Number_Of_Events_Since_Last_Snapshot_Is_One(domainRepository, LoadAggregateAsync(domainRepository)).ConfigureAwait(false); }
public PutBlockCommandHandler(IDomainRepository repository) { _repository = repository; }
public async Task Should_Correctly_Count_Number_Of_Events_Since_Last_Snapshot_And_Load_From_Latest_Snapshot_For_Load_From_Latest() { IDomainRepository domainRepository = GetDomainRepository(); await this.Should_Correctly_Count_Number_Of_Events_Since_Last_Snapshot_And_Load_From_Latest_Snapshot(domainRepository).ConfigureAwait(false); }
private static Func <TestAggregate, Task> LoadAggregateAsync(IDomainRepository domainRepository) { return(domainRepository.LoadFromLatestSnapshotAsync); }
public RemoteFacade(IDomainRepository repository, IAggregateRootCreationStrategy factory) { _repository = repository; _factory = factory; }
public async Task Given_An_Aggregate_That_Has_Been_Saved_And_Had_A_Snapshot_Saved_And_Had_Subsequent_Events_Committed_When_The_Aggregate_Is_Loaded_From_The_Snapshot_Then_The_Aggregate_State_Includes_The_Events_Committed_After_The_Snapshot_Was_Saved_For_Load_From_Latest() { IDomainRepository domainRepository = GetDomainRepository(); await this.Given_An_Aggregate_That_Has_Been_Saved_And_Had_A_Snapshot_Saved_And_Had_Subsequent_Events_Committed_When_The_Aggregate_Is_Loaded_From_The_Snapshot_Then_The_Aggregate_State_Includes_The_Events_Committed_After_The_Snapshot_Was_Saved(domainRepository, LoadAggregateAsync(domainRepository)).ConfigureAwait(false); }
public DomainService(IDomainRepository domainRepository) { _domainRepository = domainRepository; }
public async Task Given_An_Aggregate_That_Has_Been_Saved_And_Had_A_Snapshot_Saved_When_The_Aggregate_Is_Loaded_From_The_Snapshot_Then_The_Aggregate_Loads_From_The_Snapshot_With_No_Additional_Events_For_Load_From_Latest() { IDomainRepository domainRepository = GetDomainRepository(); await this.Given_An_Aggregate_That_Has_Been_Saved_And_Had_A_Snapshot_Saved_When_The_Aggregate_Is_Loaded_From_The_Snapshot_Then_The_Aggregate_Loads_From_The_Snapshot_With_No_Additional_Events(domainRepository, LoadAggregateAsync(domainRepository)).ConfigureAwait(false); }
/// <summary> /// NServiceBus.Host receives AddLocationCommand and finds the /// class implementing IHandleMessages<AddLocationCommand> /// /// It then creates an instance of this class and uses the settings /// in EndpointConfig.cs to inject an instance of EventSourceDomainRepository /// in depositRepository property. NServiceBus proceeds to run the /// Handle(AddLocation message) methods parsing in the methid sent from the /// LocationController across the bus /// /// In this example NServiceBus is self hosted in a command Windows /// and when it first loads it scans in EndpointConfig.cs if present /// /// </summary> public AddLocationHandler() { domainRepository = (IDomainRepository)UnityConfig.GetConfiguredContainer().Resolve(typeof(IDomainRepository)); }
public async Task Given_An_Aggregate_Loaded_From_A_Snapshot_Then_The_Number_Of_Events_Since_Last_Snapshot_Count_Is_Zero_After_The_Load_And_One_After_An_Update_For_Load_From_Latest() { IDomainRepository domainRepository = GetDomainRepository(); await this.Given_An_Aggregate_Loaded_From_A_Snapshot_Then_The_Number_Of_Events_Since_Last_Snapshot_Count_Is_Zero_After_The_Load_And_One_After_An_Update(domainRepository, LoadAggregateAsync(domainRepository)).ConfigureAwait(false); }
public GetDocumentQueryHandler(IFileRepository fileRepository, IDomainRepository domainRepository) { this.fileRepository = fileRepository; this.domainRepository = domainRepository; }
public async Task Given_An_Aggregate_Throughout_The_Lifecycle_When_The_Number_Of_Events_Since_Last_Snapshot_Checked_Then_It_Reports_The_Correct_Value_For_Load_From_Latest() { IDomainRepository domainRepository = GetDomainRepository(); await this.Given_An_Aggregate_Throughout_The_Lifecycle_When_The_Number_Of_Events_Since_Last_Snapshot_Checked_Then_It_Reports_The_Correct_Value(domainRepository, LoadAggregateAsync(domainRepository)).ConfigureAwait(false); }
public InStoreBookInventoryCommandHandler(IDomainRepository domainRepository, IInventoryReportDataAccessor dataAccesor, ICommandTracker tracker, ILogger logger) : base(domainRepository, dataAccesor, tracker, logger) { }
public AllCommandHandlers(IDomainRepository domainRepository) { _domainRepository = domainRepository; }
/// <summary> /// Allows you to chain mutator functions to run after execution of a query. /// </summary> /// <typeparam name="TResult">Query result type.</typeparam> /// <param name="query">Query to mutate.</param> /// <returns>A query context that allows chaining of mutator functions.</returns> public static IDomainRepositoryQueryContext <TResult> WithQuery <TResult>(this IDomainRepository domainRepository, IQuery <TResult> query) { var extendableContentRepository = domainRepository.AsExtendableContentRepository(); return(DomainRepositoryQueryContextFactory.Create(query, extendableContentRepository)); }
public TestAggregateThing(IDomainRepository repository) { this.repository = repository; }
/// <summary> /// Used to manage transactions for multiple domain commands. /// This abstraction is an enhanced version of /// System.Transaction.TransactionScope and works in the same way. /// </summary> public static IDomainRepositoryTransactionManager Transactions(this IDomainRepository domainRepository) { var extendedContentRepositry = domainRepository.AsExtendableContentRepository(); return(extendedContentRepositry.ServiceProvider.GetRequiredService <IDomainRepositoryTransactionManager>()); }
public ReturnBookRequestCreatedEventHandler(IInventoryReportDataAccessor reportDataAccessor, ICommandTracker commandTracker, ILogger logger, IDomainRepository domainRepository, IEventPublisher eventPublisher) : base(reportDataAccessor, commandTracker, logger, domainRepository, eventPublisher) { }
public GetDomainByName(IDomainRepository domainRepository) { this.domainRepository = domainRepository; }
public FeatureApplicationServices(IDomainRepository repository) { this.repository = repository; }
public CourseNameChangerHandler(IDomainRepository <Domain.CourseModule.Course> domainRepository) { _domainRepository = domainRepository; }
public DomainServiceImplementation(ILibraryConfiguration xXXLibraryConfiguration, IDomainRepository domainRepository) { _domainRepository = domainRepository; }
public DomainService(IScopeProvider provider, ILogger logger, IEventMessagesFactory eventMessagesFactory, IDomainRepository domainRepository) : base(provider, logger, eventMessagesFactory) { _domainRepository = domainRepository; }
public DashboardController(IDomainRepository<Project> projectRepository, IDomainRepository<NewsItem> newsItemRepository) { _projectRepository = projectRepository; _newsItemRepository = newsItemRepository; }
public AuthorizationService(IDomainRepository<UserPermission> permissionsRepository) { _permissionsRepository = permissionsRepository; }