Example #1
0
        public static void Main(string[] args)
        {
            IWebHost host = CreateWebHostBuilder(args).Build();

            IHostingEnvironment env = host.Services.GetService <IHostingEnvironment>();

            using (IServiceScope scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;
                try
                {
                    MySkyEngDbContext Context = services.GetRequiredService <MySkyEngDbContext>();
                    Context.Database.EnsureCreated();
                    //DataDbInitializer.Seed(Context);
                }
                catch (Exception ex)
                {
                    ILogger <Program> logger = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "An error occurred while seeding the database.");
                }
            }
            host.Run();
        }
Example #2
0
 public UnitOfWork(MySkyEngDbContext context)
 {
     this.context = context ?? throw new ArgumentNullException(nameof(context));
 }
Example #3
0
 public TeacherRepository(MySkyEngDbContext context) : base(context)
 {
 }
Example #4
0
 public StudentRepository(MySkyEngDbContext context) : base(context)
 {
 }
Example #5
0
 public PersonRepository(MySkyEngDbContext context) : base(context)
 {
 }
Example #6
0
 public EmployeeRepository(MySkyEngDbContext context) : base(context)
 {
 }
Example #7
0
 public Repository(MySkyEngDbContext context)
 {
     this.context = context ?? throw new ArgumentNullException(nameof(context));
 }