public override string ToString() { var cosmosString = CosmosAvailable ? $"CosmosConn = {CosmosConnectionString.Substring(0, 20)}..., DbName = {CosmosDatabaseName}" : "(no cosmos)"; return($"{Title}: Menu = {MenuSet}, sqlCon = {SqlConnectionString.Substring(0, 20)}..., {cosmosString}"); }
public void Configure(IWebJobsBuilder builder) { var cosmosConnectionString = new CosmosConnectionString(Environment.GetEnvironmentVariable(Cosmos.CosmosConnectionString)); var cosmosDatabaseId = Environment.GetEnvironmentVariable(Cosmos.CosmosDatabaseId); var cosmosCollectionId = Environment.GetEnvironmentVariable(Cosmos.CosmosCollectionId); var cosmosPartitionKey = Environment.GetEnvironmentVariable(Cosmos.CosmosPartitionKey); builder.AddDependencyInjection(); builder.Services.AddSingleton <IDocumentStorage>(x => new CosmosDocumentStorage(cosmosConnectionString, cosmosPartitionKey, cosmosDatabaseId, cosmosCollectionId)); builder.Services.AddTransient <IHttpRequestHelper, HttpRequestHelper>(); builder.Services.AddTransient <ILoggerHelper, LoggerHelper>(); builder.Services.AddScoped <IPathService, PathService>(sp => new PathService(sp.GetService <IDocumentStorage>())); builder.Services.AddTransient <ISwaggerDocumentGenerator, SwaggerDocumentGenerator>(); }