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