示例#1
0
        public WebKantoraDbRepository(WebKantoraDbContext context)
        {
            this.Context = context ?? throw new ArgumentNullException("The DbContext cannot be null.");
            this.DbSet   = this.Context.Set <T>();

            if (this.DbSet == null)
            {
                throw new NullReferenceException("The DbSet cannot be null.");
            }
        }
示例#2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              ILoggerFactory loggerFactory,
                              WebKantoraDbContext context,
                              RoleManager <Role> roleManager)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();


            app.UseIdentity();
            RolesData.SeedRoles(roleManager).Wait();


            if (env.IsDevelopment())
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseStatusCodePagesWithReExecute("/Home/Error");
                //app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseStatusCodePagesWithRedirects("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseIdentity();

            app.UseSession();
            //AutoMapperConfig automapperConfig = new AutoMapperConfig();
            //automapperConfig.Execute(Assembly.GetEntryAssembly());
            // Add external authentication middleware below. To configure them please see https://go.microsoft.com/fwlink/?LinkID=532715

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "areas",
                    template: "{area:exists}/{controller=Blog}/{action=Index}/{id?}"
                    );

                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
            DbInitializer.Initialize(context, app);
        }
示例#3
0
 public UnitOfWork(WebKantoraDbContext context)
 {
     this.context = context ?? throw new ArgumentNullException("The context cannot be null.");
 }