In MVC2 we have a custom base class
public class OurViewPage<TModel,TPresentationModel> : ViewPage<TModel>
so we have in the view a Model property and a PresentationModel property...
Our Aspx file starts with
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Our.Master"
Inherits="OurViewPage<IndexModel,IndexPresentationModel>" %>
With the MVC3 Razor view engine, would something equivalent be possible?
Your class should derive from System.Web.Mvc.WebViewPage<TModel>
In your view file you would add the following line to the top:
@inherits OurWebViewPage<IndexModel, IndexPresentationModel>
Note that you should not use the @model
syntax if you have a base class with two generic parameters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With