示例#1
0
文件: Program.cs 项目: gl-dn/MySkyEng
        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();
        }
示例#2
0
 public UnitOfWork(MySkyEngDbContext context)
 {
     this.context = context ?? throw new ArgumentNullException(nameof(context));
 }
示例#3
0
 public TeacherRepository(MySkyEngDbContext context) : base(context)
 {
 }
示例#4
0
 public StudentRepository(MySkyEngDbContext context) : base(context)
 {
 }
示例#5
0
 public PersonRepository(MySkyEngDbContext context) : base(context)
 {
 }
示例#6
0
 public EmployeeRepository(MySkyEngDbContext context) : base(context)
 {
 }
示例#7
0
 public Repository(MySkyEngDbContext context)
 {
     this.context = context ?? throw new ArgumentNullException(nameof(context));
 }