public CdbRevisionDataService(IOptions <CosmosDbOptions> cosmosDbOptions) { this.CosmosDbConfig = cosmosDbOptions.Value; // Beware: This source code is duplicated since we are use DomainString for single container to save cost this.CosmosDbContainer = new CosmosDbHelper(this.CosmosDbConfig.ConnectionString, this.CosmosDbConfig.DomainString, this.CosmosDbConfig.DomainString); }
public CosmosDmvDbHandler(IDocumentClient documentClient, IOptions <CosmosDbOptions> settings) { _documentClient = documentClient ?? throw new ArgumentNullException(nameof(documentClient)); _options = settings.Value ?? throw new ArgumentNullException(nameof(settings)); }
public CosmosDbRepository(ILoggerFactory loggerFactory, IDocumentClient client, IEventStoreJsonSerializerSettings settings, IOptions <CosmosDbOptions> options) { _logger = loggerFactory.CreateLogger(GetType()); _client = client ?? throw new ArgumentNullException(nameof(client)); _options = options.Value; _jsonSettings = (JsonSerializerSettings)settings ?? new JsonSerializerSettings();; }
public RevisionsController(IOptions <CosmosDbOptions> CosmosDbConfig, IOptions <AzureAdOptions> AzureAdConfig, IRevisionDataService revisionDataService, IProjectDataService projectDataService, IAzureDevOpsService azureDevOpsService) { this.CosmosDbConfig = CosmosDbConfig.Value; this.AzureAdConfig = AzureAdConfig.Value; this.RevisionDataService = revisionDataService; this.ProjectDataService = projectDataService; this.AzureDevOpsService = azureDevOpsService; }
public DocumentDbClient( IOptions <CosmosDbOptions> options, ILogger <DocumentDbClient> logger, DocumentClient documentClient) { _options = options.Value; _logger = logger; _documentClient = documentClient; }
public TemplateApiController(IServicePrincipalRepository servicePrincipalRepo, IResourceManagerRepository resourceManagerRepo, IOptions <CosmosDbOptions> cosmosDbOptions, ILogger <TemplateApiController> logger) : base(servicePrincipalRepo, resourceManagerRepo) { this.cosmosDbOptions = cosmosDbOptions.Value; this.logger = logger; }
public CosmosDbContext(CosmosDbOptions options) { if (options == null) { throw new InvalidOperationException("The options argument at CosmosDbContext is mandatory."); } CosmosClient = options.CosmosClient; DiscoverAndInitializeCollections(); }
/// <summary> /// Main Constructor /// </summary> /// <param name="templateRepo">Repository Template Service</param> /// <param name="categoryRepo">Repository Category Service</param> /// <param name="userProfile">User Profile Service</param> public TemplateApiController(ICosmosDBRepository <Template> templateRepo, ICosmosDBRepository <Category> categoryRepo, IUserProfileService userProfile, ILogger <TemplateApiController> logger, IOptions <CosmosDbOptions> cosmosDbOptions, IOptions <AzureAdOptions> azureOptions) : base(userProfile) { _templateRepo = templateRepo; _categoryRepo = categoryRepo; this.logger = logger; _cosmosDbOptions = cosmosDbOptions.Value; _azureOptions = azureOptions.Value; }
public ReleasesController(IOptions <CosmosDbOptions> CosmosDbConfig, IOptions <AzureAdOptions> AzureAdConfig, IReleaseDataService releaseDataService, IRevisionDataService revisionDataService, IProjectDataService projectDataService, IAzureDevOpsService azureDevOpsService, IHubContext <Hubs.BroadcastStatusHub> broadcastStatusHubContext) { this.CosmosDbConfig = CosmosDbConfig.Value; this.AzureAdConfig = AzureAdConfig.Value; this.ReleaseDataService = releaseDataService; this.RevisionDataService = revisionDataService; this.ProjectDataService = projectDataService; this.AzureDevOpsService = azureDevOpsService; this.BroadcastStatusHubContext = broadcastStatusHubContext; }
public ProceduresController(IOptions <CosmosDbOptions> CosmosDbConfig, IProjectDataService projectDataService, IRevisionDataService revisionDataService, IProcedureDataService procedureDataService, IProcedureExecutionDataService procedureExecutionDataService, IHubContext <Hubs.BroadcastStatusHub> broadcastStatusHubContext) { this.CosmosDbConfig = CosmosDbConfig.Value; ProjectDataService = projectDataService; RevisionDataService = revisionDataService; ProcedureDataService = procedureDataService; ProcedureExecutionDataService = procedureExecutionDataService; BroadcastStatusHubContext = broadcastStatusHubContext; }
/// <summary> /// Main Controller /// </summary> /// <param name="userProfile">User Service</param> /// <param name="blobRepo">Blob Repository</param> public AzureBlobStorageController(IUserProfileService userProfile, IBlobStorageRepository blobRepo, IOptionsSnapshot <IoTHubOptions> iotOptions, IOptionsSnapshot <BlobOptions> blobOptions, IOptionsSnapshot <CosmosDbOptions> cosmostOptions, ILogger <AzureBlobStorageController> logger) : base(userProfile) { _blobRepo = blobRepo; this.logger = logger; this.cosmostOptions = cosmostOptions.Value; this.iotOptions = iotOptions.Value; this.blobOptions = blobOptions.Value; }
private Option <CosmosDbOptions> GetCosmosDbOptions() { CosmosDbOptions cosmosDbOptions = new CosmosDbOptions(); Configuration.GetSection("CosmosDb").Bind(cosmosDbOptions); cosmosDbOptions.AccountEndpoint = Configuration["CosmosDb:AccountEndpoint"]; cosmosDbOptions.AccountKey = Configuration["CosmosDb:AccountKey"]; if (cosmosDbOptions.AccountEndpoint != null && cosmosDbOptions.AccountKey != null && cosmosDbOptions.DatabaseName != null) { return(cosmosDbOptions); } else { return(Prelude.None); } }
private static void ConfigureCosmosDb(IServiceCollection aServiceCollection) { using IServiceScope scope = aServiceCollection.BuildServiceProvider().CreateScope(); { CosmosDbOptions cosmosOptions = scope.ServiceProvider.GetRequiredService <IOptions <CosmosDbOptions> >().Value; aServiceCollection.AddDbContext <CosmosDbContext> ( aDbContextOptionsBuilder => aDbContextOptionsBuilder .UseCosmos ( accountEndpoint: cosmosOptions.EndPoint, accountKey: cosmosOptions.AccessKey, databaseName: nameof(CosmosDbContext) ) ); } }
public static IServiceCollection AddCosmosDb(this IServiceCollection services, CosmosDbOptions cosmosDbOptions) { var documentClient = new DocumentClient(cosmosDbOptions.Endpoint, cosmosDbOptions.Key, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore, ContractResolver = new CamelCasePropertyNamesContractResolver() }); documentClient.OpenAsync().Wait(); var collectionNames = cosmosDbOptions.Collections.Select(n => n.Name).ToList(); var cosmosDbClientFactory = new CosmosDbClientFactory(cosmosDbOptions.DatabaseName, collectionNames, documentClient); cosmosDbClientFactory.EnsureDbSetupAsync().Wait(); services.AddSingleton <ICosmosDbClientFactory>(cosmosDbClientFactory); return(services); }
public CosmosDomainDbContext(DbContextOptions <DomainDbContext> options, CosmosDbOptions settings) : base(options) { _settings = settings; }
public ApiDatabaseOptions(CosmosDbOptions cosmosDbOptions) { this.cosmosDbOptions = cosmosDbOptions ?? throw new System.ArgumentNullException(nameof(cosmosDbOptions)); }
public VideoStoreContext(CosmosDbOptions <VideoStoreContext> options) : base(options) { }
public CosmosDatabaseProvider(IOptions <CosmosDbOptions> settings) { _settings = settings.Value; }
public DatabaseOptions(CosmosDbOptions cosmosDbOptions) { this.cosmosDbOptions = cosmosDbOptions; }
public CosmosDbOptionBuilder(CosmosDbOptions options) { _cosmosDbOptions = options; _cosmosDbOption = new CosmosDbOption(); _cosmosClientSettings = new CosmosClientOptions(); }
public CosmosDocumentRepository(CosmosDbOptions options) { _cosmosDb = new CosmosClient(options.Account, options.Key).GetDatabase(options.Database); _collectionLookup = options.CollectionLookup; }
public ProjectsController(IOptions <CosmosDbOptions> CosmosDbConfig, IProjectDataService projectDataService) { this.CosmosDbConfig = CosmosDbConfig.Value; this.ProjectDataService = projectDataService; }
// ReSharper disable once UnusedMember.Local private static async Task <ItemsRepoCosmos> InitializeCosmosClientInstanceAsync(CosmosDbOptions cosmosDbOptions) { var client = new Microsoft.Azure.Cosmos.CosmosClient( cosmosDbOptions.Account, cosmosDbOptions.Key); var cosmosDbService = new ItemsRepoCosmos( client, cosmosDbOptions.DatabaseName, cosmosDbOptions.ContainerName); var database = await client.CreateDatabaseIfNotExistsAsync( cosmosDbOptions.DatabaseName); await database.Database.CreateContainerIfNotExistsAsync( cosmosDbOptions.ContainerName, "/id"); return(cosmosDbService); }