This project is read-only.

strongly typed views?

Sep 28, 2012 at 5:35 PM

Does razorengine support strongly typed templates?  From the getting started docs it appears that the provided models are always anonymous.

In contrast, when I'm working in an full-blown MVC project I can put

@model MyProject.Entities.Dog

at the top of my view and then my IDE is smart enough to suggest properties of the Dog type as I write my code.

What about partial views?  There's a lot of nice features I'm used to using from MVC3 that would be great to use with razorengine. 

Great work by the way!  I spent the morning looking for a way to to razor without MVC and this project appears to be the best solution so far



Oct 3, 2012 at 11:27 AM
Edited Oct 3, 2012 at 11:28 AM

Hi Peter,


Does this help you?

Specifically in the example here a custom Template derives from TemplateBase<T> with a strongly typed model version:

@inherits MyCustomizedTemplate<InvoiceModel>
Oct 3, 2012 at 3:37 PM

Thank markchivs!  This is exactly what I needed!