public static void Initialise(XpenseDbContext context) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var organisations = GetOrganisations(); var employees = GetEmployees(organisations); if (!context.Organisations.Any()) { context.Organisations.AddRange(organisations); } if (!context.Employees.Any()) { context.Employees.AddRange(employees); } if (context.ChangeTracker.HasChanges()) { context.SaveChanges(); } }
public BaseRepository(XpenseDbContext context) { _context = context; }
public OrganisationRepository(XpenseDbContext context) : base(context) { }
public EmployeeRepository(XpenseDbContext context) : base(context) { }