Exemple #1
0
        /// <summary>
        /// Конструктор.
        /// </summary>
        /// <param name="transactionContext">Контекст транзакций.</param>
        /// <param name="mapper">Экземпляр автомаппера.</param>
        /// <param name="rabbitService">Сервис брокера сообщений.</param>
        public TransactionService(TransactionContext transactionContext,
                                  IMapper mapper,
                                  IRabbitMQService rabbitService)
        {
            _transactionContext = transactionContext ?? throw new ArgumentException(nameof(transactionContext));
            _mapper             = mapper ?? throw new ArgumentException(nameof(mapper));
            _rabbitService      = rabbitService ?? throw new ArgumentException(nameof(rabbitService));

            _rabbitService.ConfigureServiceDefault();
        }
        /// <summary>
        /// Конструктор.
        /// </summary>
        /// <param name="profileContext">контекст.</param>
        /// <param name="mapper">профиль AutoMapper.</param>
        /// <param name="rabbitService">Сервис брокера сообщений.</param>
        /// /// <param name="scopeFactory">Фабрика для создания объектов IServiceScope.</param>
        public ProfileService(ProfileContext profileContext,
                              IMapper mapper,
                              IRabbitMQService rabbitService,
                              IServiceScopeFactory scopeFactory)
        {
            _profileContext = profileContext ?? throw new ArgumentException(nameof(profileContext));
            _mapper         = mapper ?? throw new ArgumentException(nameof(mapper));
            _rabbitService  = rabbitService ?? throw new ArgumentException(nameof(rabbitService));
            _scopeFactory   = scopeFactory ?? throw new ArgumentException(nameof(scopeFactory));

            _rabbitService.ConfigureServiceDefault();
            _rabbitService.SetListener("ProfileAPI", OnIncomingMessage);
        }