コード例 #1
0
 protected CommandHandler(ArchDbContext architectureContext, IDomainNotification notifications, IEventRepository eventRepository, EventSourcingContext eventSourcingContext)
 {
     _architectureContext  = architectureContext;
     _notifications        = notifications;
     _eventRepository      = eventRepository;
     _eventSourcingContext = eventSourcingContext;
 }
コード例 #2
0
 public ApplicationService(IApplicationRepository applicationRepository, ISsoService ssoService, IMapper mapper, IDomainNotification domainNotification)
 {
     _applicationRepository = applicationRepository;
     _ssoService            = ssoService;
     _mapper             = mapper;
     _domainNotification = domainNotification;
 }
コード例 #3
0
        public async Task PublishDomainNotificationAsync <TAggregateRootId>(IDomainNotification <TAggregateRootId> notification,
                                                                            CancellationToken token = default)
        {
            notification.WithEventingContext(_domainEvent);

            await _domainNotificationPublisher.PublishAsync(notification, token);
        }
コード例 #4
0
 public TransactionService(IAccountRepository accountRepository, IUnitOfWork unitOfWork,
                           IDomainNotification notification)
 {
     _accountRepository = accountRepository;
     _unitOfWork        = unitOfWork;
     _notification      = notification;
 }
コード例 #5
0
 public CustomerController(
     IDomainNotification notifications,
     IProcessor processor, IEventRepository eventRepository) : base(notifications)
 {
     _processor       = processor;
     _eventRepository = eventRepository;
 }
 public CustomerController(
     IProcessor processor,
     IDomainNotification notifications, AuthService authService)
     : base(notifications)
 {
     _processor   = processor;
     _authService = authService;
 }
コード例 #7
0
        public IEnumerable <IDomainNotification> Handle(IDomainNotification evt)
        {
            this.updatedReadModels.Clear();

            MethodExecutor.ExecuteMethod(this, evt.Event);

            return(this.updatedReadModels);
        }
コード例 #8
0
 public CustomerCommandHandler(
     ArchDbContext architectureContext,
     IDomainNotification notifications,
     IEventRepository eventRepository,
     EventSourcingContext eventSourcingContext) : base(architectureContext, notifications, eventRepository, eventSourcingContext)
 {
     _architectureContext = architectureContext;
 }
コード例 #9
0
 public CustomerService(ICustomerRepository customerRepository, IViaCEPService viaCEPService, IDomainNotification domainNotification, IUnitOfWork unitOfWork, IMapper mapper)
 {
     _customerRepository = customerRepository;
     _viaCEPService      = viaCEPService;
     _domainNotification = domainNotification;
     _unitOfWork         = unitOfWork;
     _mapper             = mapper;
 }
コード例 #10
0
        public void SetUp()
        {
            _unitOfWork         = new Mock <IUnitOfWork>();
            _usuarioRepository  = new Mock <IUsuarioRepository>();
            _domainNotification = new DomainNotification();

            _usuarioService = new UsuarioService(_usuarioRepository.Object, _unitOfWork.Object, _domainNotification);
        }
コード例 #11
0
        internal static IDomainNotification WithEventingContext <TAggregateRootId>(this IDomainNotification <TAggregateRootId> notification, IDomainEvent @event)
        {
            notification.ApplicationCommandId          = @event.ApplicationCommandId;
            notification.ApplicationCommandType        = @event.ApplicationCommandType;
            notification.ApplicationCommandReplyScheme = @event.ApplicationCommandReplyScheme;

            return(notification);
        }
コード例 #12
0
 public CourseService(IMapper mapper, IDomainNotification domainNotification, IUnitOfWork unitOfWork, ICategoryRepository categoryRepository, ICourseRepository courseRepository)
 {
     _mapper             = mapper;
     _domainNotification = domainNotification;
     _unitOfWork         = unitOfWork;
     _categoryRepository = categoryRepository;
     _courseRepository   = courseRepository;
 }
コード例 #13
0
 public ExchangeRateService(
     IForeignExchangeRatesService foreignExchangeRatesService,
     IDomainNotification domainNotification,
     IOptions <ExchangeRatePerSegment> exchangeRatePerSegment)
 {
     _foreignExchangeRatesService = foreignExchangeRatesService;
     _domainNotification          = domainNotification;
     _exchangeRatePerSegment      = exchangeRatePerSegment.Value;
 }
 public CustomerCommandHandler(
     ArchContext context,
     IDomainNotification notifications,
     EventSourcingContext eventSourcingContext)
     : base(context, eventSourcingContext, notifications)
 {
     _context = context;
     _eventSourcingContext = eventSourcingContext;
 }
コード例 #15
0
        public virtual void Publish(IDomainNotification evt)
        {
            if (this.onPublish != null)
            {
                this.onPublish(evt);
            }

            this.Events.Add(evt);
        }
コード例 #16
0
 public ProductCommandHandler(IUnitOfWork uow, IDomainNotification notifications,
                              IProductRepository productRepository,
                              IProductQuestionAnswerRepository productQuestionAnswerRepository,
                              IProductImageRepository productImageRepository) : base(uow, notifications)
 {
     _productQuestionAnswerRepository = productQuestionAnswerRepository;
     _productRepository      = productRepository;
     _productImageRepository = productImageRepository;
 }
コード例 #17
0
 public CommandHandlerBase(
     ArchContext context,
     EventSourcingContext eventSourcingContext,
     IDomainNotification notifications)
 {
     _context              = context;
     _notifications        = notifications;
     _eventSourcingContext = eventSourcingContext;
 }
コード例 #18
0
        public virtual void Publish(IDomainNotification evt)
        {
            if (this.onPublish != null)
            {
                this.onPublish(evt);
            }

            this.Events.Add(evt);
        }
 public ListCommandHandler(
     ArchDbContext architectureContext,
     EventSourcingContext eventSourcingContext,
     IDomainNotification notifications)
 {
     _architectureContext  = architectureContext;
     _eventSourcingContext = eventSourcingContext;
     _notifications        = notifications;
 }
コード例 #20
0
 public AuthorizationCommandHandler(IUnitOfWork uow, IDomainNotification notifications,
                                    JwtTokenConfig jwtTokenConfig, IUserRepository userRepository, IPasswordHasherService passwordHasherService,
                                    IShopperRepository shopperRepository) : base(uow, notifications)
 {
     _jwtTokenConfig        = jwtTokenConfig;
     _userRepository        = userRepository;
     _passwordHasherService = passwordHasherService;
     _shopperRepository     = shopperRepository;
 }
 protected CommandHandler(
     ArchCoreContext architectureContext, IDomainNotification notifications, IEventRepository eventRepository,
     EventSourcingCoreContext eventSourcingContext, AuthService authService)
 {
     _architectureContext  = architectureContext;
     _notifications        = notifications;
     _eventRepository      = eventRepository;
     _eventSourcingContext = eventSourcingContext;
     _authService          = authService;
 }
コード例 #22
0
 public ShopperCommandHandler(IUnitOfWork uow, IDomainNotification notifications, IUserRepository userRepository,
                              IPasswordHasherService passwordHasherService, IShopperRepository shopperRepository,
                              IShopperAddressRepository shopperAddressRepository) : base(uow,
                                                                                         notifications)
 {
     _userRepository           = userRepository;
     _passwordHasherService    = passwordHasherService;
     _shopperRepository        = shopperRepository;
     _shopperAddressRepository = shopperAddressRepository;
 }
コード例 #23
0
 public OrderController
 (
     IDomainNotification domainNotification,
     IOrderService orderService,
     IMapper mapper
 ) : base(domainNotification)
 {
     _orderService = orderService;
     _mapper       = mapper;
 }
 public OrderCommandHandler(
     ArchCoreContext architectureContext,
     IDomainNotification notifications,
     IEventRepository eventRepository,
     EventSourcingCoreContext eventSourcingContext,
     AuthService authService)
     : base(architectureContext, notifications, eventRepository, eventSourcingContext, authService)
 {
     _architectureContext = architectureContext;
 }
コード例 #25
0
        public void Publish <TAggregateRootId>(IDomainNotification <TAggregateRootId> notification)
        {
            if (notification == null)
            {
                throw new ArgumentNullException(nameof(notification));
            }

            notification.Topic = _options.Topic;

            _messagePublisher.Publish(notification);
        }
コード例 #26
0
 public AccountAppService(
     IAccountRepository accountRepository,
     IMapper mapper,
     ITransactionService transactionService,
     IDomainNotification notification)
 {
     _accountRepository  = accountRepository;
     _mapper             = mapper;
     _transactionService = transactionService;
     _notification       = notification;
 }
コード例 #27
0
 public OrderProductController
 (
     IDomainNotification domainNotification,
     IMapper mapper,
     IOrderService orderService,
     IOrderProductService orderProductService
 ) : base(domainNotification)
 {
     _mapper              = mapper;
     _orderService        = orderService;
     _orderProductService = orderProductService;
 }
コード例 #28
0
        private void PublishEvents(IAggregateRoot instance, IDomainNotification snapshotChange)
        {
            foreach (var evt in instance.UncommittedEvents.ToList())
            {
                var modelChange = NotificationExtensions.CreateNotification(instance.GetType(), evt);
                this.changes.OnNext(modelChange);
            }

            if (snapshotChange != null)
            {
                this.changes.OnNext(snapshotChange);
            }
        }
コード例 #29
0
        private async Task PublishDomainNotificationAsync(IDomainNotification notification, CancellationToken token)
        {
            var publisher = _serviceProvider.GetService <IDomainNotificationPublisher>();

            try
            {
                await publisher.PublishAsync(notification, token);
            }
            catch (Exception e)
            {
                _logger.LogError($"Publishing domain notification has a exception: {LogFormatter.PrintException(e)}.");
            }
        }
コード例 #30
0
        public static bool NeedReplyApplicationCommand(this IDomainNotification notification, out IEndSubTransactionDomainNotification needRepliedNotification)
        {
            if (notification.ApplicationCommandReplyScheme == ApplicationCommandReplySchemes.OnDomainCommandHandled &&
                notification is IEndSubTransactionDomainNotification endNotification)
            {
                needRepliedNotification = endNotification;

                return(true);
            }

            needRepliedNotification = null;
            return(false);
        }
コード例 #31
0
        public async Task PublishAsync <TAggregateRootId>(
            IDomainNotification <TAggregateRootId> notification,
            CancellationToken token)
        {
            if (notification == null)
            {
                throw new ArgumentNullException(nameof(notification));
            }

            notification.Topic = _options.Topic;

            await _messagePublisher.PublishAsync(notification, token);
        }
コード例 #32
0
        private void PublishEvents(IAggregateRoot instance, IDomainNotification snapshotChange)
        {
            foreach (var evt in instance.UncommittedEvents.ToList())
            {
                var modelChange = NotificationExtensions.CreateNotification(instance.GetType(), evt);
                this.changes.OnNext(modelChange);
            }

            if (snapshotChange != null)
            {
                this.changes.OnNext(snapshotChange);
            }
        }
コード例 #33
0
 public void Publish(IDomainNotification evt)
 {
     this.eventPublisher.OnNext(evt);
 }
コード例 #34
0
ファイル: MockBus.cs プロジェクト: sgmunn/Mobile.CQRS
 public void Publish(IDomainNotification evt)
 {
     this.PublishedEvents.Add(evt);
 }