subsonic with ASP.net MVC2 strongly typed views
I have an MVC project setup, and I've brought the subsonic Active Record templates into my project, and they generated successfully and I can use the subsonic classes to access my database. However, how do I create a strongly typed view using t开发者_StackOverflow社区he subsonic generated classes? When I select "add View" and I check the checkbox to create a strongly-typed view, none of the generated classes from subsonic for my data are available. How do I do this?
You probably need to compile your project first.
I would try it manually and see if you get any errors. Crack open your view and change:
Inherits="System.Web.Mvc.ViewPage"
to
Inherits="System.Web.Mvc.ViewPage<Your.Strongly.Typed.ClassName>"
You can also add the namespace in the web.config under pages->namespaces
<add namespace="Your.Strongly.Typed" />
if you want to shorten the change to:
Inherits="System.Web.Mvc.ViewPage<ClassName>"
精彩评论