public static IServiceCollection AddSqlAdapter(this IServiceCollection services, SqlAdapterConfiguration sqlAdapterConfiguration) { if (sqlAdapterConfiguration == null) { throw new ArgumentNullException(nameof(sqlAdapterConfiguration)); } services.AddScoped <IOSSqlAdapter, OsSqlAdapter>(); services.AddScoped <IDbConnection>(d => { return(new SqlConnection(sqlAdapterConfiguration.ConnectionString)); }); return(services); }
public static IServiceCollection AddTmdbAdapter(this IServiceCollection services, SqlAdapterConfiguration sqlAdapterConfiguration) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (sqlAdapterConfiguration == null) { throw new ArgumentNullException(nameof(sqlAdapterConfiguration)); } // Registra a instancia do objeto de configuracoes desta camanda. services.AddSingleton(sqlAdapterConfiguration); services.AddScoped <IDbConnection>(d => { return(new SqlConnection(sqlAdapterConfiguration.SqlConnectionString)); }); services.AddScoped <ITmdbRepository, TmdbRepository>(); return(services); }