Exemplo n.º 1
0
        public static void AddDataAccess(this IServiceCollection services, IConfiguration configuration)
        {
            services.AddDbContext <CurrencyExchangeContext>(
                (serviceProvider, options) =>
                options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")),
                ServiceLifetime.Transient,
                ServiceLifetime.Scoped
                );

            services.AddScoped <IUnitOfWork, UnitOfWork>(ServiceProvider =>
            {
                CurrencyExchangeContext context = ServiceProvider.GetRequiredService <CurrencyExchangeContext>();
                var unitOfWork = new UnitOfWork(context);
                unitOfWork.RegisterRepositoryWithAssembly(typeof(IGenericRepository <,>).Assembly);
                return(unitOfWork);
            });
        }
 public CityRepository(CurrencyExchangeContext currencyExchangeContext) : base(currencyExchangeContext)
 {
 }
Exemplo n.º 3
0
 public LoggingRepository(CurrencyExchangeContext context)
 {
     _context = context;
 }
 public CurrencyExchangeRepository(CurrencyExchangeContext context)
 {
     _context = context;
 }
 public CurrencyArchiveRepository(CurrencyExchangeContext currencyExchangeContext) : base(currencyExchangeContext)
 {
 }