public static IServiceCollection AddFluentCommander(this IServiceCollection services, IConfiguration config) { new CommanderBootstrapper().Bootstrap(services); services.AddScoped <IDatabaseCommanderFactory, OracleDatabaseCommanderFactory>(); var connectionStringCollection = new ConnectionStringCollection(config); if (connectionStringCollection.ConnectionStringNames.Contains("DefaultConnection")) { services.AddSingleton(new OracleConnectionStringBuilder(connectionStringCollection.Get("DefaultConnection"))); services.AddTransient <IDatabaseCommander, OracleDatabaseCommander>(); } return(services); }
public IServiceCollection Bootstrap(IServiceCollection services, IConfiguration configuration) { new CommanderBootstrapper().Bootstrap(services); services.AddTransient <SqlServerBulkCopyCommand>(); services.AddTransient <SqlServerPaginationCommand>(); services.AddTransient(typeof(SqlServerScalarCommand <>)); services.AddTransient <SqlServerSqlNonQueryCommand>(); services.AddTransient <SqlServerSqlQueryCommand>(); services.AddTransient <SqlServerStoredProcedureCommand>(); services.AddTransient <ISqlServerCommandExecutor, SqlServerCommandExecutor>(); var connectionStringCollection = new ConnectionStringCollection(configuration); if (connectionStringCollection.ConnectionStringNames.Contains("DefaultConnection")) { services.AddSingleton(new SqlConnectionStringBuilder(connectionStringCollection.Get("DefaultConnection"))); services.AddTransient <IDatabaseCommander, SqlServerDatabaseCommander>(); } return(services); }