private Connection GetConnection(CosmosDbServiceInfo info, IConfiguration configuration) { var cosmosConfig = new CosmosDbConnectorOptions(configuration); var configurer = new CosmosDbProviderConfigurer(); var conn = new Connection(configurer.Configure(info, cosmosConfig), "CosmosDb", info); conn.Properties.Add("DatabaseId", cosmosConfig.DatabaseId); conn.Properties.Add("DatabaseLink", cosmosConfig.DatabaseLink); return(conn); }
public Connection Get(IConfiguration configuration, string serviceName) { var info = serviceName == null ? configuration.GetSingletonServiceInfo <CosmosDbServiceInfo>() : configuration.GetRequiredServiceInfo <CosmosDbServiceInfo>(serviceName); var cosmosConfig = new CosmosDbConnectorOptions(configuration) { UseReadOnlyCredentials = true }; var configurer = new CosmosDbProviderConfigurer(); return(new Connection { ConnectionString = configurer.Configure(info, cosmosConfig), Name = "CosmosDbReadOnly" + serviceName?.Insert(0, "-") }); }
public Connection Get(IConfiguration configuration, string serviceName) { var info = serviceName == null ? configuration.GetSingletonServiceInfo <CosmosDbServiceInfo>() : configuration.GetRequiredServiceInfo <CosmosDbServiceInfo>(serviceName); var cosmosConfig = new CosmosDbConnectorOptions(configuration); var configurer = new CosmosDbProviderConfigurer(); var conn = new Connection { ConnectionString = configurer.Configure(info, cosmosConfig), Name = "CosmosDb" + serviceName?.Insert(0, "-") }; conn.Properties.Add("DatabaseId", cosmosConfig.DatabaseId); conn.Properties.Add("DatabaseLink", cosmosConfig.DatabaseLink); return(conn); }