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