public static IServiceCollection AddCosmyClient(this IServiceCollection services, string endpoint, string key) { var configuration = new CosmyConfiguration { Endpoint = endpoint, Key = key }; var client = new DocumentClient(new Uri(configuration.Endpoint), configuration.Key); services.AddSingleton(configuration); services.AddSingleton(client); services.AddSingleton <ICosmyClient, CosmyClient>(); return(services); }
public CosmyClient(DocumentClient documentClient, CosmyConfiguration configuration) { this.documentClient = documentClient; this.configuration = configuration; }