Esempio n. 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();
        }
Esempio n. 2
0
 public UnitOfWork(MySkyEngDbContext context)
 {
     this.context = context ?? throw new ArgumentNullException(nameof(context));
 }
Esempio n. 3
0
 public TeacherRepository(MySkyEngDbContext context) : base(context)
 {
 }
Esempio n. 4
0
 public StudentRepository(MySkyEngDbContext context) : base(context)
 {
 }
Esempio n. 5
0
 public PersonRepository(MySkyEngDbContext context) : base(context)
 {
 }
Esempio n. 6
0
 public EmployeeRepository(MySkyEngDbContext context) : base(context)
 {
 }
Esempio n. 7
0
 public Repository(MySkyEngDbContext context)
 {
     this.context = context ?? throw new ArgumentNullException(nameof(context));
 }