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();
            }
        }
Exemple #2
0
 public BaseRepository(XpenseDbContext context)
 {
     _context = context;
 }
Exemple #3
0
 public OrganisationRepository(XpenseDbContext context) : base(context)
 {
 }
Exemple #4
0
 public EmployeeRepository(XpenseDbContext context) : base(context)
 {
 }