internal override IServiceCollection AddOrm(IServiceCollection services, IConfiguration configuration = null) { IConfigurationSection dbConnectionSettings = ResolveConfiguration.GetConnectionSettings(configuration) .GetSection("ConnectionStrings"); services.Configure <DataSettings>(dbConnectionSettings); services.AddScoped <IDatabaseFactory, DatabaseFactory>(); services.AddScoped <IUserRepository, UserRepository>(); services.AddScoped <ITasksToDoRepository, TasksToDoRepository>(); return(services); }
internal override IServiceCollection AddOrm(IServiceCollection services, IConfiguration configuration = null) { IConfiguration dbConnectionSettings = ResolveConfiguration.GetConnectionSettings(configuration); string conn = dbConnectionSettings.GetConnectionString("DefaultConnection"); services.AddDbContext <ApplicationContext>(options => options.UseSqlServer(conn)); services.AddScoped(typeof(IRepositoryAsync <>), typeof(RepositoryAsync <>)); services.AddScoped <IDeveloperRepository, DeveloperRepository>(); services.AddScoped <IProjectRepository, ProjectRepository>(); return(services); }
public static void InfrastructureEntityFramework(this IServiceCollection services, IConfiguration configuration = null) { IConfiguration dbConnectionSettings = ResolveConfiguration.GetConnectionSettings(configuration); string conn = dbConnectionSettings.GetConnectionString("DefaultConnection"); services.AddDbContext <ApplicationContext>(options => options.UseSqlServer(conn)); /*Users*/ services.AddScoped <IUserRepository, EntityFrameworkUser>(); services.AddScoped <IUserEntityFrameworkRepository, EntityFrameworkUser>(); /*TaskToDo*/ services.AddScoped <ITaskToDoRepository, EntityFrameworkTaskToDo>(); services.AddScoped <ITaskToDoEntityFrameworkRepository, EntityFrameworkTaskToDo>(); }
internal override IServiceCollection AddOrm(IServiceCollection services, IConfiguration configuration = null) { IConfiguration dbConnectionSettings = ResolveConfiguration.GetConnectionSettings(configuration); string conn = dbConnectionSettings.GetConnectionString("DefaultConnection"); services.AddDbContext <ApplicationContext>(options => options.UseSqlServer(conn)); services.AddScoped(typeof(IRepositoryAsync <>), typeof(RepositoryAsync <>)); services.AddScoped <IUserRepository, UserRepository>(); services.AddScoped <IFileRepository, FileRepository>(); services.AddScoped <ITaskToDoRepository, TaskToDoRepository>(); services.AddScoped <ISheetAdmissionRepository, SheetAdmissionRepository>(); services.AddScoped <IImportsRepository, ImportsRepository>(); return(services); }
public static void InfrastructureDapper(this IServiceCollection services, IConfiguration configuration = null) { IConfigurationSection dbConnectionSettings = ResolveConfiguration.GetConnectionSettings(configuration) .GetSection("ConnectionStrings"); /* Using IOptions on constructor to create a instance of SqlConnection */ services.Configure <DataOptionFactory>(dbConnectionSettings); /* Using a Factory on constructor to create a instance of RepositoryDapper * with IDBConnection on constructor to return a instance of SqlConnection * I won't use it any more because I'd turned the RepositoryDapperBase an abstract class */ //services.AddScoped<IDataServiceFactory, DataServiceFactory>(_ => new DataServiceFactory(configuration.GetConnectionString("DefaultConnection"))); /*Users*/ services.AddScoped <IUserRepository, DapperUser>(); services.AddScoped <IUserDapperRepository, DapperUser>(); /*TaskToDo*/ services.AddScoped <ITaskToDoRepository, DapperTaskToDo>(); services.AddScoped <ITaskToDoDapperRepository, DapperTaskToDo>(); }