hi guys
As I said in my last post, I just moved to razor pages and tyring to get a hang of it.
In MVC I always inherit a base controller in all my controllers e.g. for admin accounts I have my custom configs. Now I am using razor pages, It seems I have to update every single page which is cumbersome. is there an easier way ? here is my code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using Virtuals.Models.Department;
using Virtuals.Web.Classes;
namespace Virtuals.Web.Pages.Admin.CRUD
{
public class DeleteModel : MyCustom_PageModel
{
private readonly Virtuals.Web.Classes.MyDbContext _context;
public DeleteModel(Virtuals.Web.Classes.MyDbContext context)
{
_context = context;
}
I want all admin pages to inherit a custom class e.g.
using Microsoft.AspNetCore.Mvc.RazorPages; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace VirtualMarkets.Web.Classes { public class MyCustom_PageModel : PageModel {
//add my custom config here
Owing to the fact that razor pages unline MVC has no central "God" object e.g controller, do I manually update all code behind ?
thanks
Ehi