public XDbProvider(string redisConnectionString, ICosmosDb cosmosCosmosDb)
        {
            DocumentCosmosDb = cosmosCosmosDb;

            Connect(redisConnectionString);
            Resolver = new DocDbRedisResolver(this);
        }
Ejemplo n.º 2
0
        public TestingContext(Action <ICosmosDbBuilder> builderCallback, Action <ICosmosDbRepositoryBuilder> repoBuilderCallback)
        {
            var services = TestFramework.Services;

            DbConfig   = services.GetRequiredService <IOptions <CosmosDbConfig> >().Value;
            TestConfig = services.GetRequiredService <IOptions <TestConfig> >().Value.Clone();
            EnvConfig  = services.GetRequiredService <IOptions <EnvironmentConfig> >().Value;

            if (EnvConfig.RandomizeCollectionName)
            {
                TestConfig.CollectionName = $"{TestConfig.CollectionName}{Guid.NewGuid()}";
            }

            DbClient = new DocumentClient(new Uri(DbConfig.DbEndPoint), DbConfig.DbKey);
            var builder = new CosmosDbBuilder()
                          .WithId(DbConfig.DbName)
                          .WithDefaultThroughput(400)
                          .AddCollection <T>(TestConfig.CollectionName, repoBuilderCallback);

            builderCallback?.Invoke(builder);

            CosmosDb = builder.Build(DbClient);

            Repo = CosmosDb.Repository <T>();
        }
Ejemplo n.º 3
0
 public CosmosDbCollection(ICosmosDb cosmosDb, ICosmosDbCollectionConfig config, PartitionKeyProvider <TModel> partitionKeyProvider = null)
 {
     if (cosmosDb == null)
     {
         throw new ArgumentNullException(nameof(cosmosDb));
     }
     if (config == null)
     {
         throw new ArgumentNullException(nameof(config));
     }
     if (config.DatabaseId == null)
     {
         throw new ArgumentNullException($"Missing configuration for DatabaseId: {this.GetType().Name} ");
     }
     if (config.ContainerId == null)
     {
         throw new ArgumentNullException($"Missing configuration for ContainerId: {this.GetType().Name} ");
     }
     this.cosmosDb             = cosmosDb;
     this.config               = config;
     this.partitionKeyProvider = partitionKeyProvider;
 }
        public ICosmosDbRepository Build(IDocumentClient client, ICosmosDb documentDb, int?defaultThroughput)
        {
            if (string.IsNullOrWhiteSpace(Id))
            {
                throw new InvalidOperationException("Id not specified");
            }

            var indexingPolicy = new IndexingPolicy
            {
                IndexingMode = _indexingMode
            };

            if (_includePaths.Any())
            {
                indexingPolicy.IncludedPaths = new Collection <IncludedPath>(_includePaths);
            }

            if (_excludePaths.Any())
            {
                indexingPolicy.ExcludedPaths = new Collection <ExcludedPath>(_excludePaths);
            }

            return(new CosmosDbRepository <T>(client, documentDb, Id, indexingPolicy, _throughput ?? defaultThroughput, _storedProcedure));
        }
 public CosmosProductRepository(ICosmosDb cosmosDbService_)
 {
     cosmosDbService = cosmosDbService_;
 }
Ejemplo n.º 6
0
 public TransactionData(ICosmosDb cosmos)
 {
     _cosmos = Check.NotNull(cosmos, nameof(cosmos)); TransactionDataCtor();
 }
Ejemplo n.º 7
0
 public ReferenceDataData(ICosmosDb cosmos)
 {
     _cosmos = Check.NotNull(cosmos, nameof(cosmos)); DataCtor();
 }
Ejemplo n.º 8
0
 public TransactionData(ICosmosDb cosmos, AutoMapper.IMapper mapper)
 {
     _cosmos = Check.NotNull(cosmos, nameof(cosmos)); _mapper = Check.NotNull(mapper, nameof(mapper)); TransactionDataCtor();
 }
Ejemplo n.º 9
0
 public AccountData(ICosmosDb cosmos)
 {
     _cosmos = Check.NotNull(cosmos, nameof(cosmos)); AccountDataCtor();
 }
 public CosmosController(ICosmosDb cosmos)
 {
     _cosmos = cosmos;
 }
Ejemplo n.º 11
0
 public PartitionRepository(ICosmosDb cosmos, string containerName)
 {
     this.cosmos    = cosmos;
     this.container = this.cosmos.CreateContainer(containerName).Result;
 }
Ejemplo n.º 12
0
 public CosmosRepository(ICosmosDb db)
 {
     this.FoodRepository = new FoodRepository <Food>(db);
 }
Ejemplo n.º 13
0
 public ReferenceDataData(IDatabase db, IEfDb ef, ICosmosDb cosmos)
 {
     _db = Check.NotNull(db, nameof(db)); _ef = Check.NotNull(ef, nameof(ef)); _cosmos = Check.NotNull(cosmos, nameof(cosmos)); DataCtor();
 }
Ejemplo n.º 14
0
 public FoodRepository(ICosmosDb cosmos) : base(cosmos, "/FoodGroup")
 {
 }
Ejemplo n.º 15
0
 public ReferenceDataData(IDatabase db, IEfDb ef, ICosmosDb cosmos, AutoMapper.IMapper mapper)
 {
     _db = Check.NotNull(db, nameof(db)); _ef = Check.NotNull(ef, nameof(ef)); _cosmos = Check.NotNull(cosmos, nameof(cosmos)); _mapper = Check.NotNull(mapper, nameof(mapper)); DataCtor();
 }
Ejemplo n.º 16
0
 public Stores(ICosmosDb cosmosDb)
 {
     _storeRepository = cosmosDb.Repository <StoreDocument>();
 }
Ejemplo n.º 17
0
 public AccountData(ICosmosDb cosmos, AutoMapper.IMapper mapper)
 {
     _cosmos = Check.NotNull(cosmos, nameof(cosmos)); _mapper = Check.NotNull(mapper, nameof(mapper)); AccountDataCtor();
 }
Ejemplo n.º 18
0
 public ReferenceDataData(ICosmosDb cosmos, AutoMapper.IMapper mapper)
 {
     _cosmos = Check.NotNull(cosmos, nameof(cosmos)); _mapper = Check.NotNull(mapper, nameof(mapper)); ReferenceDataDataCtor();
 }
Ejemplo n.º 19
0
 public RobotData(ICosmosDb cosmos)
 {
     _cosmos = Check.NotNull(cosmos, nameof(cosmos)); RobotDataCtor();
 }
Ejemplo n.º 20
0
 public Queue(ICosmosDb cosmosDb)
 {
     _queueRepository = cosmosDb.Repository <QueueDocument>();
 }
 public CosmosOrderRepository(ICosmosDb cosmosDbService_)
 {
     cosmosDbService = cosmosDbService_;
 }