Esempio n. 1
0
 private static void Migrate(IApplicationBuilder app)
 {
     using (var serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope())
     {
         using (NsrCommonDbContext context = serviceScope.ServiceProvider.GetService <NsrCommonDbContext>())
         {
             context.Database.Migrate();
         }
     }
 }
Esempio n. 2
0
        public static void UseNsrCommon(IApplicationBuilder app)
        {
            using (var serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                using (NsrCommonDbContext context = serviceScope.ServiceProvider.GetService <NsrCommonDbContext>())
                {
                    context.Database.Migrate();
                }
            }

            ServiceLocator.Instance = app.ApplicationServices;

            Migrate(app);
        }
Esempio n. 3
0
 public CommonBaseRepository(NsrCommonDbContext context)
 {
     Context = context;
 }