Exemple #1
0
 public DicUnitResponse(NoDataOptions options, Globle globle, WDbContext wDbContext) : base(options)
 {
     DicUnits        = DefaultDatabase.GetCollection <DicUnit>(DicUnit.DicUnitTableName);
     this.globle     = globle;
     dicBckFolder    = globle.GetGlobleFolder <DicBckFolder>();
     this.wDbContext = wDbContext;
 }
Exemple #2
0
        protected void Flushdb()
        {
            _dbContext?.Dispose();
            var serviceProvider = new ServiceCollection()
                                  .AddEntityFrameworkInMemoryDatabase()
                                  .BuildServiceProvider();
            var builder = new DbContextOptionsBuilder <WDbContext>()
                          .UseInMemoryDatabase("fwadb")
                          .UseInternalServiceProvider(serviceProvider);

            _dbContext = new WDbContext(builder.Options);
            _dbContext.Database.EnsureCreated();
            BatchUpdateManager.InMemoryDbContextFactory = () => _dbContext;
        }
Exemple #3
0
 public UserResponse(WDbContext dbContext,
                     UserManager <SUser> userManager,
                     SignInManager <SUser> signInManager,
                     RoleManager <SRole> roleManager,
                     STokenProvider tokenProvider,
                     Globle globle)
     : base(dbContext)
 {
     _userManager        = userManager;
     _signInManager      = signInManager;
     _roleManager        = roleManager;
     _tokenProvider      = tokenProvider;
     _globle             = globle;
     _headPortraitFolder = _globle.GetGlobleFolder <HeadPortraitFolder>();
 }
Exemple #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            //app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseSpaStaticFiles();
            app.UseAuthentication();
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller}/{action=Index}/{id?}");
            });
            app.UseCors();
            app.UseSpa(spa =>
            {
                // To learn more about options for serving an Angular SPA from ASP.NET Core,
                // see https://go.microsoft.com/fwlink/?linkid=864501

                spa.Options.SourcePath = "ClientApp";

                if (env.IsDevelopment())
                {
                    spa.UseAngularCliServer(npmScript: "start");
                }
            });
            using (var db = new WDbContext())
            {
                db.Database.EnsureCreated();
            }
        }
Exemple #5
0
 protected DataResponseBase(WDbContext dbContext)
 {
     DbContext = dbContext;
 }