Пример #1
0
 public MongoDbQuerySagaRepository(
     IMongoDatabase database,
     ICollectionNameFormatter collectionNameFormatter
     )
 {
     _collection = database.GetCollection <TSaga>(collectionNameFormatter);
 }
Пример #2
0
 public MongoDbSagaRepository(IMongoDatabase database,
                              IMongoDbSagaConsumeContextFactory mongoDbSagaConsumeContextFactory,
                              ICollectionNameFormatter collectionNameFormatter)
 {
     _mongoDbSagaConsumeContextFactory = mongoDbSagaConsumeContextFactory;
     _collection = database.GetCollection <TSaga>(collectionNameFormatter);
 }
Пример #3
0
        public MongoDbSagaRepository(IMongoDatabase database, ICollectionNameFormatter collectionNameFormatter)
        {
            var mongoDbSagaConsumeContextFactory = new MongoDbSagaConsumeContextFactory <TSaga>();

            _repositoryContextFactory =
                new MongoDbSagaRepositoryContextFactory <TSaga>(database.GetCollection <TSaga>(collectionNameFormatter), mongoDbSagaConsumeContextFactory);
            _repository = new SagaRepository <TSaga>(_repositoryContextFactory);
        }
Пример #4
0
        public static ISagaRepository <TSaga> Create(IMongoDatabase database, ICollectionNameFormatter collectionNameFormatter)
        {
            var mongoDbSagaConsumeContextFactory = new SagaConsumeContextFactory <IMongoCollection <TSaga>, TSaga>();

            var repositoryContextFactory = new MongoDbSagaRepositoryContextFactory <TSaga>(database.GetCollection <TSaga>(collectionNameFormatter),
                                                                                           mongoDbSagaConsumeContextFactory);

            return(new SagaRepository <TSaga>(repositoryContextFactory));
        }
Пример #5
0
        /// <summary>
        /// Sets the collection name formatter instance <see cref="ICollectionNameFormatter"/>
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="collectionNameFormatter"></param>
        public static void CollectionNameFormatter(this IMongoDbSagaRepositoryConfigurator configurator, ICollectionNameFormatter collectionNameFormatter)
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }
            if (collectionNameFormatter == null)
            {
                throw new ArgumentNullException(nameof(collectionNameFormatter));
            }

            configurator.CollectionNameFormatter(_ => collectionNameFormatter);
        }
Пример #6
0
 public static IMongoCollection <TSaga> GetCollection <TSaga>(this IMongoDatabase database, ICollectionNameFormatter collectionNameFormatter)
     where TSaga : class, ISaga =>
 database.GetCollection <TSaga>(collectionNameFormatter.Saga <TSaga>());
 public DotCollectionNameFormatter_Specs()
 {
     _collectionNameFormatter = new DotCaseCollectionNameFormatter();
 }
Пример #8
0
 /// <summary>
 /// Sets the collection name formatter instance <see cref="ICollectionNameFormatter"/>
 /// </summary>
 /// <param name="configurator"></param>
 /// <param name="collectionNameFormatter"></param>
 public static void CollectionNameFormatter(this IMongoDbSagaRepositoryConfigurator configurator, ICollectionNameFormatter collectionNameFormatter)
 {
     configurator.CollectionNameFormatter(_ => collectionNameFormatter);
 }