private static IServiceCollection ConfigurePerRequestBillChopContext(this IServiceCollection services) { return(services.AddScoped((serviceProvider) => { var transaction = serviceProvider.GetService <DbTransaction>() ?? throw new Exception("Could not acquire DbTransaction service"); var options = serviceProvider.GetService <DbContextOptions <BillChopContext> >() ?? throw new Exception("Could not acquire DbContextOptions service"); var context = new BillChopContext(options); context.Database.UseTransaction(transaction); return context; })); }
public static IHost MigrateBillChopDb(this IHost webHost) { var connectionString = ConnectionStringResolver.GetBillChopDbConnectionString(); var options = new DbContextOptionsBuilder <BillChopContext>() .UseSqlServer(connectionString) .UseLazyLoadingProxies() .Options; var dbContext = new BillChopContext(options); dbContext.Database.Migrate(); return(webHost); }
public LoanEFRepository(BillChopContext context) { this.context = context; }
public GroupEFRepository(BillChopContext context) { this.context = context; }
public PaymentEFRepository(BillChopContext context) { this.context = context; }
public UserEFRepository(BillChopContext context) { this.context = context; }