Exemplo n.º 1
0
 public AddCustomEntityCommandHandler(
     IQueryExecutor queryExecutor,
     ICommandExecutor commandExecutor,
     CofoundryDbContext dbContext,
     EntityAuditHelper entityAuditHelper,
     ICustomEntityCache customEntityCache,
     IDbUnstructuredDataSerializer dbUnstructuredDataSerializer,
     IMessageAggregator messageAggregator,
     ICustomEntityDefinitionRepository customEntityDefinitionRepository,
     IPermissionValidationService permissionValidationService,
     ITransactionScopeFactory transactionScopeFactory,
     ICustomEntityStoredProcedures customEntityStoredProcedures
     )
 {
     _queryExecutor                    = queryExecutor;
     _commandExecutor                  = commandExecutor;
     _dbContext                        = dbContext;
     _entityAuditHelper                = entityAuditHelper;
     _customEntityCache                = customEntityCache;
     _dbUnstructuredDataSerializer     = dbUnstructuredDataSerializer;
     _messageAggregator                = messageAggregator;
     _customEntityDefinitionRepository = customEntityDefinitionRepository;
     _permissionValidationService      = permissionValidationService;
     _transactionScopeFactory          = transactionScopeFactory;
     _customEntityStoredProcedures     = customEntityStoredProcedures;
 }
Exemplo n.º 2
0
        /// <summary>
        /// 使用<see cref="TransactionScope"/>实现<see cref="IUnitOfWork"/>接口
        /// if the parameter <paramref name="isDtcAllowed"/> is true, the connection of UnitOfWork not needed to create.
        /// else the connection need to create and bound to the thread.
        /// </summary>
        /// <param name="isDtcAllowed">是否允许使用DTC</param>
        /// <param name="transactionScopeFactory">实现<see cref="ITransactionScopeFactory"/>接口的实例,用来创建<see cref="TransactionScope"/></param>
        /// <param name="unitOfWorkDefinition">实现<see cref="IUnitOfWorkDefinition"/>接口的实例,用来定义事务环境</param>
        /// <param name="dbProvider">实现<see cref="IDbProvider"/>的实例.</param>
        public TransactionScopeUnitOfWork(bool isDtcAllowed, ITransactionScopeFactory transactionScopeFactory,
                                          IUnitOfWorkDefinition unitOfWorkDefinition, IDbProvider dbProvider)
        {
            IsDTCAllowed = isDtcAllowed;

            if (unitOfWorkDefinition == null)
            {
                unitOfWorkDefinition = UnitOfWorkDefinition.DefaultDefinition;
            }
            CheckUnitOfWorkDefinition(unitOfWorkDefinition);
            Definition = unitOfWorkDefinition;

            if (transactionScopeFactory == null)
            {
                transactionScopeFactory = new TransactionScopeFactory(unitOfWorkDefinition);
            }

            scope = transactionScopeFactory.GetInstance();

            System.Transactions.Transaction.Current.TransactionCompleted +=
                (o, args) => Logger.Debug(m => m("Current transaction completed with status {0}.",
                                                 args.Transaction.TransactionInformation.Status));

            //不允许使用分布式事务,则DAO方式必须使用同一个Connection,需要在事务开始前创建Connection,并放入当前线程中。
            if (!IsDTCAllowed)
            {
                CheckDbProvider(dbProvider);
                DbProvider = dbProvider;

                //开始事务,创建连接,并压入当前线程
                BeginTransaction(DbProvider, Definition);
            }
        }
Exemplo n.º 3
0
 public AdminDomain(IConfigRepository cfgRepo, IUserRepository userRepo, IInventoryRepository inventoryRepo, IJwtProvider jwtProvider, ITransactionScopeFactory transactionScopeFactory)
 {
     ConfigRepo              = cfgRepo;
     UserRepo                = userRepo;
     InventoryRepo           = inventoryRepo;
     JwtProvider             = jwtProvider;
     TransactionScopeFactory = transactionScopeFactory;
 }
Exemplo n.º 4
0
 public GameDomain(IConfigRepository cfgRepo, IGameRepository gameRepository, UserDomain userDomain, IJwtProvider jwtProvider, ITransactionScopeFactory transactionScopeFactory)
 {
     ConfigRepo              = cfgRepo;
     UserDomain              = userDomain;
     GameRepo                = gameRepository;
     JwtProvider             = jwtProvider;
     TransactionScopeFactory = transactionScopeFactory;
 }
Exemplo n.º 5
0
 public MessageDomain(IMessageRepository messageRepo, UserDomain userDomain,
                      IHubContext <NotificationHub, IUserClient> hubContext, ITransactionScopeFactory transactionScopeFactory)
 {
     MessageRepo             = messageRepo;
     UserDomain              = userDomain;
     SignalRHubContext       = hubContext;
     TransactionScopeFactory = transactionScopeFactory;
 }
Exemplo n.º 6
0
 public UserDomain(IUserRepository userRepo, IFriendshipRepository friendRepo, IJwtProvider jwtProvider, IHubContext <NotificationHub, IUserClient> hubContext, ITransactionScopeFactory transactionScopeFactory)
 {
     UserRepo                = userRepo;
     FriendRepo              = friendRepo;
     JWTProvider             = jwtProvider;
     TransactionScopeFactory = transactionScopeFactory;
     SignalRHubContext       = hubContext;
 }
Exemplo n.º 7
0
 public MessageCategoryController(
     ITransactionScopeFactory transactionScopeFactory,
     IQueryProcessor queryProcessor
     )
 {
     _transactionScopeFactory = transactionScopeFactory;
     _queryProcessor          = queryProcessor;
 }
Exemplo n.º 8
0
        public DefaultConfigurator TransactionScopeFactory(ITransactionScopeFactory transactionScopeFactory)
        {
            Guard.AgainstNull(transactionScopeFactory, "transactionScopeFactory");

            _configuration.TransactionScopeFactory = transactionScopeFactory;

            return(this);
        }
Exemplo n.º 9
0
 public NpcDomain(IInventoryRepository inventoryRepo, IConfigRepository configRepo, InventoryDomain inventoryDomain, INpcStateRepository npcStateRepo, ITransactionScopeFactory transactionScopeFactory)
 {
     InventoryRepo           = inventoryRepo;
     ConfigRepo              = configRepo;
     InventoryDomain         = inventoryDomain;
     TransactionScopeFactory = transactionScopeFactory;
     this.npcStateRepo       = npcStateRepo;
 }
Exemplo n.º 10
0
 public SearchDomain(UserDomain userDomain, IUserRepository userRepo, IFriendshipRepository friendRepo, IJwtProvider jwtProvider, ITransactionScopeFactory transactionScopeFactory)
 {
     UserDomain              = userDomain;
     UserRepo                = userRepo;
     FriendRepo              = friendRepo;
     JWTProvider             = jwtProvider;
     TransactionScopeFactory = transactionScopeFactory;
 }
        public ServiceBusConfigurator TransactionScopeFactory(ITransactionScopeFactory transactionScopeFactory)
        {
            Guard.AgainstNull(transactionScopeFactory, "transactionScopeFactory");

            configuration.TransactionScopeFactory = transactionScopeFactory;

            return(this);
        }
Exemplo n.º 12
0
 public InventoryDomain(IInventoryRepository inventoryRepo, IConfigRepository configRepo, UserDomain userDomain,
                        IHubContext <NotificationHub, IUserClient> hubContext, ITransactionScopeFactory transactionScopeFactory)
 {
     InventoryRepo           = inventoryRepo;
     ConfigRepo              = configRepo;
     SignalRHubContext       = hubContext;
     UserDomain              = userDomain;
     TransactionScopeFactory = transactionScopeFactory;
 }
Exemplo n.º 13
0
 public ItemUseDomain(IInventoryRepository inventoryRepo, IConfigRepository configRepo,
                      UserDomain userDomain, PetDomain petDomain, ITransactionScopeFactory transactionScopeFactory)
 {
     InventoryRepo           = inventoryRepo;
     ConfigRepo              = configRepo;
     UserDomain              = userDomain;
     PetDomain               = petDomain;
     TransactionScopeFactory = transactionScopeFactory;
 }
Exemplo n.º 14
0
 public UsersRepository(
     YastahDbContext context,
     ILogger <UsersRepository> logger,
     ITransactionScopeFactory transactionScopeFactory)
 {
     _context = context;
     _logger  = logger;
     _transactionScopeFactory = transactionScopeFactory;
 }
Exemplo n.º 15
0
        public CommandHandlerActor(CommandExecutionStrategy commandExecutionStrategy, Type commandHandlerType, IServiceScopeFactory serviceScopeFactory, ITransactionScopeFactory transactionScopeFactory)
        {
            _commandExecutionStrategy = commandExecutionStrategy;
            _commandHandlerType       = commandHandlerType;
            _serviceScopeFactory      = serviceScopeFactory;
            _transactionScopeFactory  = transactionScopeFactory;

            ReceiveAsync <Command>(Handle);
        }
Exemplo n.º 16
0
 public EventDomain(UserDomain userDomain, IHubContext <NotificationHub, IUserClient> hubContext, IRandomEventRepository randomEvents,
                    InventoryDomain inventoryDomain, ITransactionScopeFactory transactionScopeFactory)
 {
     UserDomain              = userDomain;
     HubContext              = hubContext;
     RandomEvents            = randomEvents;
     InventoryDomain         = inventoryDomain;
     TransactionScopeFactory = transactionScopeFactory;
 }
 public CharacterGuildsRepository(
     YastahDbContext context,
     ILogger <CharacterGuildsRepository> logger,
     ITransactionScopeFactory transactionScopeFactory)
 {
     _context = context;
     _logger  = logger;
     _transactionScopeFactory = transactionScopeFactory;
 }
Exemplo n.º 18
0
 public BetScreenshotProcessor(ITransactionScopeFactory transactionScopeFactory, IUnitOfWorkScopeFactory unitOfWorkScopeFactory, IRepository<BetScreenshot> repositoryOfBetScreenshot, IRepository<Bet> repositoryOfBet, IScreenshotMakerFactory screenshotMakerFactory, IScreenshotAmazonS3Putter screenshotAmazonS3Putter, IBetScreenshotPathService betScreenshotPathService)
 {
     _transactionScopeFactory = transactionScopeFactory;
     _unitOfWorkScopeFactory = unitOfWorkScopeFactory;
     _repositoryOfBetScreenshot = repositoryOfBetScreenshot;
     _repositoryOfBet = repositoryOfBet;
     _screenshotMakerFactory = screenshotMakerFactory;
     _screenshotAmazonS3Putter = screenshotAmazonS3Putter;
     _betScreenshotPathService = betScreenshotPathService;
 }
 public DeleteDocumentAssetCommandHandler(
     CofoundryDbContext dbContext,
     ICommandExecutor commandExecutor,
     ITransactionScopeFactory transactionScopeFactory
     )
 {
     _dbContext               = dbContext;
     _commandExecutor         = commandExecutor;
     _transactionScopeFactory = transactionScopeFactory;
 }
Exemplo n.º 20
0
 public DocumentAssetCommandHelper(
     CofoundryDbContext dbContext,
     IFileStoreService fileStoreService,
     ITransactionScopeFactory transactionScopeFactory
     )
 {
     _dbContext               = dbContext;
     _fileStoreService        = fileStoreService;
     _transactionScopeFactory = transactionScopeFactory;
 }
Exemplo n.º 21
0
 public RepostUserEventHandler(
     ITransactionScopeFactory transactionScopeFactory,
     IBackgroundJobService jobService,
     ILogger <RepostUserEventHandler> logger, IMessageBroker messageBroker)
 {
     _transactionScopeFactory = transactionScopeFactory;
     _jobService    = jobService;
     _logger        = logger;
     _messageBroker = messageBroker;
 }
Exemplo n.º 22
0
 public ShopDomain(IShopRepository shopRepo, IInventoryRepository inventoryRepo, IConfigRepository configRepo,
                   UserDomain userDomain, InventoryDomain inventoryDomain, ITransactionScopeFactory transactionScopeFactory)
 {
     InventoryRepo           = inventoryRepo;
     ShopRepo                = shopRepo;
     ConfigRepo              = configRepo;
     UserDomain              = userDomain;
     InventoryDomain         = inventoryDomain;
     TransactionScopeFactory = transactionScopeFactory;
 }
Exemplo n.º 23
0
 public UserMessageQueryHandler(
     ITransactionScopeFactory transactionScopeFactory,
     IAuthenticatedUserProvider authenticatedUserProvider,
     IVkWallService vkClient
     )
 {
     _transactionScopeFactory   = transactionScopeFactory;
     _authenticatedUserProvider = authenticatedUserProvider;
     _vkClient = vkClient;
 }
Exemplo n.º 24
0
 public MessageProcessor(
     IActiveMqMessageMapper activeMqMessageMapper,
     ISessionFactory sessionFactory,
     IActiveMqPurger purger,
     ITransactionScopeFactory transactionScopeFactory)
 {
     this.activeMqMessageMapper = activeMqMessageMapper;
     this.sessionFactory = sessionFactory;
     this.purger = purger;
     this.transactionScopeFactory = transactionScopeFactory;
 }
Exemplo n.º 25
0
 public BattlesService(ITransactionScopeFactory transactionScopeFactory, IUnitOfWorkScopeFactory unitOfWorkScopeFactory, IRepository<Battle> repositoryOfBattle, IRepository<Team> repositoryOfTeam, IRepository<Bet> repositoryOfBet, IRepository<BetScreenshot> repositoryOfBetScreenshot, IRepository<TeamBattleStatistics> repositoryOfTeamBattleStatistics, IRepository<TeamStatistics> repositoryOfTeamStatistics)
 {
     _transactionScopeFactory = transactionScopeFactory;
     _repositoryOfBattle = repositoryOfBattle;
     _repositoryOfTeam = repositoryOfTeam;
     _repositoryOfBet = repositoryOfBet;
     _repositoryOfBetScreenshot = repositoryOfBetScreenshot;
     _repositoryOfTeamBattleStatistics = repositoryOfTeamBattleStatistics;
     _repositoryOfTeamStatistics = repositoryOfTeamStatistics;
     _unitOfWorkScopeFactory = unitOfWorkScopeFactory;
 }
Exemplo n.º 26
0
 public MessageProcessor(
     IActiveMqMessageMapper activeMqMessageMapper,
     ISessionFactory sessionFactory,
     IActiveMqPurger purger,
     ITransactionScopeFactory transactionScopeFactory)
 {
     this.activeMqMessageMapper = activeMqMessageMapper;
     this.sessionFactory        = sessionFactory;
     this.purger = purger;
     this.transactionScopeFactory = transactionScopeFactory;
 }
 public DeleteWebDirectoryCommandHandler(
     CofoundryDbContext dbContext,
     IWebDirectoryCache cache,
     ICommandExecutor commandExecutor,
     ITransactionScopeFactory transactionScopeFactory
     )
 {
     _dbContext               = dbContext;
     _cache                   = cache;
     _commandExecutor         = commandExecutor;
     _transactionScopeFactory = transactionScopeFactory;
 }
Exemplo n.º 28
0
 public DeleteImageAssetCommandHandler(
     CofoundryDbContext dbContext,
     IImageAssetCache imageAssetCache,
     ICommandExecutor commandExecutor,
     ITransactionScopeFactory transactionScopeFactory
     )
 {
     _dbContext               = dbContext;
     _imageAssetCache         = imageAssetCache;
     _commandExecutor         = commandExecutor;
     _transactionScopeFactory = transactionScopeFactory;
 }
 public DeleteDocumentAssetCommandHandler(
     CofoundryDbContext dbContext,
     ICommandExecutor commandExecutor,
     ITransactionScopeFactory transactionScopeFactory,
     IMessageAggregator messageAggregator
     )
 {
     _dbContext               = dbContext;
     _commandExecutor         = commandExecutor;
     _transactionScopeFactory = transactionScopeFactory;
     _messageAggregator       = messageAggregator;
 }
Exemplo n.º 30
0
 public VkMessageService(
     IElasticClientFactory elasticClientFactory,
     ITransactionScopeFactory transactionScopeFactory,
     MessagePredicting.MessagePredictingClient messagePredictingClient,
     ILogger <VkMessageService> logger
     )
 {
     _elasticClientFactory    = elasticClientFactory;
     _transactionScopeFactory = transactionScopeFactory;
     _messagePredictingClient = messagePredictingClient;
     _logger = logger;
 }
Exemplo n.º 31
0
 public AccountCreator(IAccountService accountService, ITransactionScopeFactory transactionScopeFactory)
 {
     if (accountService == null)
     {
         throw new ArgumentNullException(nameof(accountService));
     }
     if (transactionScopeFactory == null)
     {
         throw new ArgumentNullException(nameof(transactionScopeFactory));
     }
     _accountService          = accountService;
     _transactionScopeFactory = transactionScopeFactory;
 }
 public CharacterGuildsService(
     IAuditableActionsRepository auditableActionsRepository,
     ICharacterGuildsRepository characterGuildsRepository,
     ILogger <CharacterGuildsService> logger,
     ISystemClock systemClock,
     ITransactionScopeFactory transactionScopeFactory)
 {
     _auditableActionsRepository = auditableActionsRepository;
     _characterGuildsRepository  = characterGuildsRepository;
     _logger                  = logger;
     _systemClock             = systemClock;
     _transactionScopeFactory = transactionScopeFactory;
 }
Exemplo n.º 33
0
 public UpdateDocumentAssetCommandHandler(
     CofoundryDbContext dbContext,
     EntityAuditHelper entityAuditHelper,
     EntityTagHelper entityTagHelper,
     DocumentAssetCommandHelper documentAssetCommandHelper,
     ITransactionScopeFactory transactionScopeFactory
     )
 {
     _dbContext                  = dbContext;
     _entityAuditHelper          = entityAuditHelper;
     _entityTagHelper            = entityTagHelper;
     _documentAssetCommandHelper = documentAssetCommandHelper;
     _transactionScopeFactory    = transactionScopeFactory;
 }
Exemplo n.º 34
0
        public GameRepository(IAsyncDbConnectionFactory connectionFactory, ITransactionScopeFactory transactionScopeFactory)
        {
            if (connectionFactory == null)
            {
                throw new ArgumentNullException("connectionFactory");
            }

            if (transactionScopeFactory == null)
            {
                throw new ArgumentNullException("transactionScopeFactory");
            }

            _connectionFactory = connectionFactory;
            _transactionScopeFactory = transactionScopeFactory;
            this.gameEventMapper = new GameEventMapper();
        }
        public DefaultConfigurator TransactionScopeFactory(ITransactionScopeFactory transactionScopeFactory)
        {
            Guard.AgainstNull(transactionScopeFactory, "transactionScopeFactory");

            _configuration.TransactionScopeFactory = transactionScopeFactory;

            return this;
        }
Exemplo n.º 36
0
        public ServiceBusConfigurator TransactionScopeFactory(ITransactionScopeFactory transactionScopeFactory)
        {
            Guard.AgainstNull(transactionScopeFactory, "transactionScopeFactory");

            configuration.TransactionScopeFactory = transactionScopeFactory;

            return this;
        }