Exemple #1
0
        private DbConnection CreateDbConnection <T>(IServiceProvider serviceProvider) where T : class, IDbConfiguration, new()
        {
            var connectionString  = serviceProvider.GetRequiredService <IOptionsSnapshot <T> >().Value.ConnectionString;
            var connectionFactory = new AzureSqlConnectionFactory(connectionString,
                                                                  serviceProvider.GetRequiredService <ISecretInjector>(), Logger);

            return(Task.Run(() => connectionFactory.CreateAsync()).Result);
        }
Exemple #2
0
        private Task <SqlConnection> CreateNuGetSqlConnection()
        {
            var connectionFactory = new AzureSqlConnectionFactory(ConnectionString, SecretInjector);

            return(connectionFactory.CreateAsync());
        }