public static void Initialize(IServiceProvider serviceProvider) { var serviceScope = serviceProvider.CreateScope(); using (TransferDBContext context = serviceScope.ServiceProvider.GetRequiredService <TransferDBContext>()) { try { context.Database.Migrate(); } catch (Exception ex) { } if (!context.TransferLogs.Any()) { context.TransferLogs.Add(new TransferLog { FromAccount = 1, ToAccount = 2, TrasnferAmount = 100 }); context.SaveChanges(); } } }
public TransferRepository(TransferDBContext context) { _ctx = context; }
public TransferRepository(TransferDBContext transferDBContext) { this.transferDBContext = transferDBContext; }
public TransferRepository(TransferDBContext ctx) { _ctx = ctx; }
public TransfeRepository(TransferDBContext transferDBContext) { _transferDBContext = transferDBContext; }