コード例 #1
0
        public CosmosDbDataRepository(ICosmosDbConfiguration cosmosDbConfiguration, CosmosClient client)
        {
            _cosmosDbConfiguration = cosmosDbConfiguration
                                     ?? throw new ArgumentNullException(nameof(cosmosDbConfiguration));

            _client = client
                      ?? throw new ArgumentNullException(nameof(client));
        }
コード例 #2
0
 public CosmosDbDataRepository(ICosmosDbConfiguration cosmosDbConfiguration,
                               CosmosClient client,
                               ILogger <CosmosDbDataRepository <T> > log)
 {
     _cosmosDbConfiguration = cosmosDbConfiguration
                              ?? throw new ArgumentNullException(nameof(cosmosDbConfiguration));
     _client = client
               ?? throw new ArgumentNullException(nameof(client));
     _log = log
            ?? throw new ArgumentNullException(nameof(log));
 }
コード例 #3
0
ファイル: AccountRepository.cs プロジェクト: teopenna/wimm
 public AccountRepository(ICosmosDbConfiguration cosmosDbConfiguration,
                          CosmosClient client) : base(cosmosDbConfiguration, client)
 {
 }
コード例 #4
0
 public CarRepository(ICosmosDbConfiguration cosmosDbConfiguration,
                      CosmosClient client,
                      ILogger <CarRepository> logger) : base(cosmosDbConfiguration, client, logger)
 {
 }
コード例 #5
0
ファイル: CosmosDbClientFactory.cs プロジェクト: leldev/CQRS
 /// <summary>
 /// Initializes a new instance of the <see cref="CosmosDbClientFactory"/> class.
 /// </summary>
 /// <param name="config">Configuration type of <see cref="ICosmosDbConfiguration"/>.</param>
 /// <param name="client">DocumentClient type of <see cref="IDocumentClient"/>.</param>
 public CosmosDbClientFactory(ICosmosDbConfiguration config, IDocumentClient client = null)
 {
     this.config = config;
     this.client = client ?? new DocumentClient(new Uri(config.Endpoint), config.AuthKey);
 }
コード例 #6
0
 public CarReservationRepository(ICosmosDbConfiguration cosmosDbConfiguration,
                                 CosmosClient client) : base(cosmosDbConfiguration, client)
 {
 }
コード例 #7
0
 public EnquiryRepository(ICosmosDbConfiguration cosmosDbConfiguration,
                          CosmosClient client,
                          ILogger <EnquiryRepository> log) : base(cosmosDbConfiguration, client, log)
 {
 }
コード例 #8
0
 public EnquiryRepository(ICosmosDbConfiguration cosmosDbConfiguration,
                          CosmosClient client) : base(cosmosDbConfiguration, client)
 {
 }
コード例 #9
0
        /// <summary>
        /// Add Cosmos Db Repositories and Services.
        /// </summary>
        /// <param name="services">Service Collection.</param>
        /// <param name="config">Configuration type of <see cref="ICosmosDbConfiguration"/>.</param>
        /// <returns>Service Collection <see cref="IServiceCollection"/>.</returns>
        public static IServiceCollection AddCosmosDb(this IServiceCollection services, ICosmosDbConfiguration config)
        {
            services.AddSingleton(config);
            services.AddScoped <IDocumentClient>(s => new DocumentClient(new Uri(config.Endpoint), config.AuthKey));

            services.AddScoped <IRepository, CosmosDbRepository>();

            new CosmosDbClientFactory(config).EnsureDbSetupAsync().Wait();

            return(services);
        }