Esempio n. 1
0
 public NotificationRepository(ApplicationDbContext context, IAuthService authService, IDomainEventBus eventBus, IMapper mapper)
 {
     _context     = context;
     _currentUser = authService.GetCurrentUser();
     _eventBus    = eventBus;
     _mapper      = mapper;
 }
Esempio n. 2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DocumentDbEventStore{TAggregateRoot, TEventSet}" /> class.
 /// </summary>
 /// <param name="client">The document DB client.</param>
 /// <param name="domainEventBus">The domain event bus.</param>
 /// <param name="snapshotRepository">The snapshot repository.</param>
 protected DocumentDbEventStore(DocumentClient client, IDomainEventBus domainEventBus,
                                ISnapshotRepository <TAggregateRoot> snapshotRepository)
 {
     Client             = client;
     DomainEventBus     = domainEventBus;
     SnapshotRepository = snapshotRepository;
 }
Esempio n. 3
0
 public AddUserCommandHandler(ILogger <AddUserCommandHandler> logger, IDomainEventBus publisher
                              , IDbSession <IUserRepository> dbSession)
     : base(publisher)
 {
     _logger    = logger;
     _dbSession = dbSession;
 }
Esempio n. 4
0
 public BatchDeleteCommandHandler(
     IRepository <TEntity, TKey> repository,
     IDomainEventBus domainEventBus)
 {
     _repository     = repository;
     _domainEventBus = domainEventBus;
 }
 public ReglasPiedraPapelTijeraSteps()
 {
     bus        = new DomainEventBus();
     partida    = new Partida(bus);
     jugador1   = new Jugador1(bus);
     jugador2   = new Jugador2(bus);
     resultados = new Resultados(bus);
 }
Esempio n. 6
0
 public AddNewPropertyDomainCommandHandler(ILoggerFactory loggerFactory,
                                           IAggregateRootEventStorage rootEventStore,
                                           IDomainEventBus domainEventBus)
     : base(loggerFactory)
 {
     this.rootEventStore = rootEventStore;
     this.domainEventBus = domainEventBus;
 }
Esempio n. 7
0
 public static void RegisterSubscriptions(IDomainEventBus domainEventBus)
 {
     domainEventBus.Subscribe <AccountCreated, AccountCreatedHandler>();
     domainEventBus.Subscribe <SystemTagAdded, SystemTagAddedHandler>();
     domainEventBus.Subscribe <AddressUpdated, AddressUpdatedHandler>();
     domainEventBus.Subscribe <AccountApproved, AccountApprovedHandler>();
     domainEventBus.Subscribe <AccountDeleted, AccountDeletedHandler>();
 }
 public CreateCommandHandler(
     IRepository <TEntity, TKey> repository,
     IDomainEventBus domainEventBus,
     IMapper mapper)
 {
     _repository     = repository;
     _domainEventBus = domainEventBus;
     _mapper         = mapper;
 }
 /// <summary>
 /// .ctor. All deps are in ctor
 /// </summary>
 /// <param name="sessionFactory"></param>
 /// <param name="sessionManager"></param>
 /// <param name="eventRouter"></param>
 public HibernateUnitOfWorkFactory(
     ISessionFactory sessionFactory,
     IHibernateSessionManager sessionManager,
     IDomainEventBus eventRouter)
 {
     _sessionFactory = sessionFactory;
     _sessionManager = sessionManager;
     _eventRouter = eventRouter;
 }
        /// <summary>
        /// .ctor with all dependencies
        /// </summary>
        /// <param name="nhibernateSessionManager"></param>
        /// <param name="eventRouter"></param>
        public HibernateUnitOfWork(
            IHibernateSessionManager nhibernateSessionManager,
            IDomainEventBus eventRouter)
        {
            _nhibernateSessionManager = nhibernateSessionManager;
            _nhibernateSessionManager.OpenSession();

            _eventRouter = eventRouter;
        }
 public QuerySideInitializer(
     IEventStoreSubscription <CustomerQueueSubscription> customerQueueEventStoreSubscription,
     IDomainEventBus domainEventBus,
     IClientNotifier clientNotifier,
     ViewHolder viewHolder)
 {
     _customerQueueEventStoreSubscription = customerQueueEventStoreSubscription;
     _domainEventBus = domainEventBus;
     _clientNotifier = clientNotifier;
     _viewHolder     = viewHolder;
 }
 public QuerySideInitializer(
     IEventStore eventStore,
     ViewsHolder viewHolder,
     IDomainEventBus domainEventBus,
     IClientNotifier clientNotifier)
 {
     _eventStore     = eventStore;
     _viewHolder     = viewHolder;
     _domainEventBus = domainEventBus;
     _clientNotifier = clientNotifier;
 }
 /// <summary>
 /// Dispatches all Domain Events.
 /// </summary>
 /// <param name="eventBus"></param>
 /// <param name="entities"></param>
 /// <returns></returns>
 public static async Task DispatchDomainEventsAsync(this IDomainEventBus eventBus, IEnumerable <IDomainEventEntity> entities)
 {
     foreach (IDomainEventEntity entity in entities)
     {
         foreach (IDomainEvent domainEvent in entity.DomainEvents)
         {
             entity.RemoveDomainEvent(domainEvent);
             await eventBus.Publish(domainEvent).ConfigureAwait(false);
         }
     }
 }
Esempio n. 14
0
 public UnitOfWork(
     CommandsDbContext context,
     IServiceProvider services,
     IDomainEventBus domainEventBus,
     IAuditor auditor)
 {
     Context             = context;
     this.services       = services;
     this.domainEventBus = domainEventBus;
     this.auditor        = auditor;
 }
Esempio n. 15
0
        public RabbitMqEventProvider(IRabbitMqEventProviderConfiguration configuration, IApplicationDefinition applicationDefinition, IDomainEventFactory domainEventFactory, IDomainEventBus domainEventBus)
        {
            _configuration          = configuration;
            _rabbitMqMessageFactory = new RabbitMqMessageFactory();

            _applicationDefinition = applicationDefinition;
            _domainEventFactory    = domainEventFactory;
            _domainEventBus        = domainEventBus;

            _connectionFactory = new ConnectionFactory {
                Uri = _configuration.Connection
            };
        }
        public FileInfoCreateCommandHandler(
            IRepository <FileItem, Guid> repository,
            IDomainEventBus domainEventBus,
            IMapper mapper,
            ISettingManager settingManage,
            IFileManager fileManager)
        {
            _repository     = repository;
            _domainEventBus = domainEventBus;
            _mapper         = mapper;

            _options = settingManage.GetApplicationOptions <FileStorageOptions>(nameof(FileStorageOptions));

            _fileManager = fileManager;
        }
        public AppUnitOfWork(
            IValidationService validationService,
            IDomainEventBus domainEventBus,
            AppContext appContext,
            IAuthorRepository authorRepository,
            IBlogPostRepository blogPostRepository,
            ICategoryRepository categoryRepository,
            ILocationRepository locationRepository,
            ITagRepository tagRepository,
            ICarouselItemRepository carouselItemRepository,
            IContentHtmlRepository contentHtmlRepository,
            IContentTextRepository contentTextRepository,
            IFaqRepository faqRepository,
            IMailingListRepository mailingListRepository,
            IProjectRepository projectRepository,
            ITestimonialRepository testimonialRepository
            )
            : base(true, validationService, domainEventBus, appContext)
        {
            AuthorRepository   = authorRepository;
            BlogPostRepository = blogPostRepository;
            CategoryRepository = categoryRepository;
            LocationRepository = locationRepository;
            TagRepository      = tagRepository;

            AddRepository(AuthorRepository);
            AddRepository(BlogPostRepository);
            AddRepository(CategoryRepository);
            AddRepository(LocationRepository);
            AddRepository(TagRepository);

            CarouselItemRepository = carouselItemRepository;
            ContentHtmlRepository  = contentHtmlRepository;
            ContentTextRepository  = contentTextRepository;
            FaqRepository          = faqRepository;
            MailingListRepository  = mailingListRepository;
            ProjectRepository      = projectRepository;
            TestimonialRepository  = testimonialRepository;

            AddRepository(CarouselItemRepository);
            AddRepository(ContentHtmlRepository);
            AddRepository(ContentTextRepository);
            AddRepository(FaqRepository);
            AddRepository(MailingListRepository);
            AddRepository(ProjectRepository);
            AddRepository(TestimonialRepository);
        }
Esempio n. 18
0
        /// <summary>
        ///   Source:
        ///   https://github.com/ardalis/CleanArchitecture/blob/master/src/CleanArchitecture.Infrastructure/Data/AppDbContext.cs
        /// </summary>
        private void SaveChangesWithEvents(IDomainEventBus domainEventBus)
        {
            var entitiesWithEvents = ChangeTracker.Entries <IAggregateRoot>()
                                     .Select(e => e.Entity)
                                     .Where(e => e.GetUncommittedEvents().Any())
                                     .ToArray();

            foreach (var entity in entitiesWithEvents)
            {
                var events = entity.GetUncommittedEvents().ToArray();
                entity.GetUncommittedEvents().Clear();
                foreach (var domainEvent in events)
                {
                    domainEventBus.Publish(new EventEnvelope(domainEvent));
                }
            }
        }
Esempio n. 19
0
 public AccountReinstatedHandler(IAccountStore accountStore, IDomainEventBus domainEventBus)
 {
     _accountStore   = accountStore;
     _domainEventBus = domainEventBus;
 }
Esempio n. 20
0
 public AccountStore(DomainDataContext context, IDomainEventBus domainEventBus,
                     ISnapshotRepository <Account> snapshotRepository) : base(context, domainEventBus, snapshotRepository)
 {
 }
Esempio n. 21
0
 public FileServiceTests()
 {
     filesApplicationService = Container.Resolve<IFilesApplicationService>();
     domainEventBus = Container.Resolve<IDomainEventBus>();
 }
Esempio n. 22
0
 public AddUserPersistentCommandHandler(IDomainEventBus publisher, IDbSession <IUserRepository> sessionDb)
     : base(publisher)
 {
     _sessionDb = sessionDb;
 }
 public DomainEventDispatcher(IDomainEventBus domainEventBus)
 {
     _domainEventBus = domainEventBus;
 }
 public DomainEventsTask(IDomainEventBus eventBus)
 {
     _eventBus = eventBus;
 }
Esempio n. 25
0
 public UpdateEntityEventBasedCommandHandler(IDomainEventBus publisher,
                                             IAggregateFactory <EventStreamBusinessEntityAggregateRoot, EventStream <EntityTestId> > aggregateFactory)
     : base(publisher)
 {
     _aggregateFactory = aggregateFactory;
 }
Esempio n. 26
0
 public SqlDomainContext(SQLiteConnection connection, IAggregateManifestRepository manifest, IEventStoreRepository eventStore, IDomainEventBus eventBus)
     : base(manifest, eventStore, eventBus)
 {
     this.Connection = connection;
 }
Esempio n. 27
0
 public MinionContext(SQLiteConnection connection, IDomainEventBus eventBus)
     : base(connection, GetManifest(connection), null, eventBus)
 {
     this.Bootstrap();
 }
 public InMemoryRepository(IDomainEventBus domainEventBus)
 {
     DomainEventBus = domainEventBus;
 }
Esempio n. 29
0
 public AggregateRepository(ISnapshotRepository snapshotRepository, IEventRepository eventRepository, IDomainEventBus bus)
 {
     this._snapshotRepository = snapshotRepository ?? throw new ArgumentNullException(nameof(snapshotRepository));
     this._eventRepository    = eventRepository ?? throw new ArgumentNullException(nameof(eventRepository));
     this._bus = bus ?? throw new ArgumentNullException(nameof(bus));
 }
Esempio n. 30
0
 public AddEntityEventBasedCommandHandler(IDomainEventBus publisher,
                                          IAggregateFactory <EventStreamBusinessEntityAggregateRoot, AddEntityCommand> aggregateFactory)
     : base(publisher)
 {
     _aggregateFactory = aggregateFactory;
 }
 public DbContextDomainEventsEFCoreAdapter(DbContext dbContext, IDomainEventBus domainEventBus)
     : base(domainEventBus)
 {
     _dbContext = dbContext;
 }
 public DbContextDomainEventsBase(IDomainEventBus domainEventBus)
 {
     _domainEventBus = domainEventBus;
 }
 public FilesApplicationService(IDomainEventBus domainEventBus)
 {
     _domainEventBus = domainEventBus;
 }
Esempio n. 34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DomainContext&lt;TContextInterface, TId&gt;"/> class.
 /// </summary>
 /// <param name="eventBus">The event publisher invoked after entities are saved to publish all generated events.</param>
 public DomainContext(IDomainEventBus <TId> eventBus)
     : this()
 {
     this.eventBus = eventBus;
 }
Esempio n. 35
0
 public AddUserCommandHandler(IDomainEventBus publisher)
     : base(publisher)
 {
 }
Esempio n. 36
0
 public AddEntityCommandHandler(IDomainEventBus publisher)
     : base(publisher)
 {
 }