I've heard Phil on a podcast say 'traditionally people make things non-virtual unless theres a good reason not to, but we decided to make things virtual unless theres a good reason not to'...
Therefore you tell me why all the Controller.UpdateModel methods are non-virtual ? Is there a legitimate good reason?
I want to be able to do this :
I have an abstract base controller, and a model (ModelBase) used by all the models in my page. I want to be able to do UpdateModel (productsModel) and have it update the base model too.
I just don't want to use 'new' as I am having to do.
public abstract class RRController : Controller
{
public RRController()
: base() {
}protected internal new void UpdateModel<TModel>(TModel model) where TModel : ModelBase
{
base.UpdateModel(model);
UpdateBaseModel(model);
}
public void UpdateBaseModel(ModelBase model)
{
model.Initialized = true;
model.PromotionID = ((string)Session["PromotionId"] ?? "").ToUpper();
model.PartnerId = ((int?)Session["PartnerId"]) ?? 6; // rolling razor #&#&#&#&#&
}
}