Exemplo n.º 1
0
        private SqlSagaStateRepository CreateSut(ISagaDbContext db,
                                                 SqlSagaStateRepositoryOptions options = null)
        {
            var serializer = new JsonSerializer();
            var sut        = new SqlSagaStateRepository(db, serializer, options ?? SqlSagaStateRepositoryOptions.Default);

            return(sut);
        }
        private Lazy <ISagaDbContext> CreateLazySagaDbContext(IncomingContext context)
        {
            Func <ISagaDbContext> lazyFunc =
                () =>
            {
                Logger.Debug("Lazy ISagaDbContext func called");
                ISagaDbContext dbc = _dbContextFactory.CreateSagaDbContext();

                Logger.Debug("Checking if Transaction.Current has a value");
                if (Transaction.Current == null)
                {
                    Logger.Debug("Current transaction does NOT exist, creating new transaction with Serializable isolation level");
                    DbContextTransaction transaction = dbc.Database.BeginTransaction(IsolationLevel.Serializable);
                    context.Set(ContextKeys.SagaTransactionKey, transaction);
                }

                return(dbc);
            };

            return(new Lazy <ISagaDbContext>(lazyFunc));
        }
 public SqlOutboxRepository(ISagaDbContext dbContext, ISerializer serializer, SqlOutboxRepositoryOptions options)
 {
     _dbContext  = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
     _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
     _options    = options ?? throw new ArgumentNullException(nameof(options));
 }
Exemplo n.º 4
0
        private CosmosSqlOutboxRepository CreateSut(ISagaDbContext sagaDbContext)
        {
            var sut = new CosmosSqlOutboxRepository(sagaDbContext, new JsonSerializer(), CosmosSqlOutboxRepositoryOptions.Default);

            return(sut);
        }
 public SqlTransactionManager(ISagaDbContext dbContext)
 {
     _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
 }
Exemplo n.º 6
0
        private SqlOutboxRepository CreateSut(ISagaDbContext db)
        {
            var sut = new SqlOutboxRepository(db, new JsonSerializer(), SqlOutboxRepositoryOptions.Default);

            return(sut);
        }
Exemplo n.º 7
0
 public CosmosSqlSagaStateRepository(ISagaDbContext dbContext, IPersistenceSerializer serializer, CosmosSqlSagaStateRepositoryOptions options)
 {
     _dbContext  = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
     _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
     _options    = options ?? throw new ArgumentNullException(nameof(options));
 }