1

I have implemented VirtualPathProvider class so I can keep all my views in the database instead of FileSystem of web server.

It seems MVC requests aspx page correctly from Database, but unable to request related codebehind .cs files and throws error as unable to load the code-behind class file.

This virtualPathProvider works like charm with normal Web Form.

Are there any specific changes I will have to make to MVC framework or any other stuff?

3
  • Not answering your question, but just wondering: why do you want your views in the database? Commented Oct 21, 2008 at 13:32
  • Seconding Paco's question.... Commented Oct 21, 2008 at 16:12
  • Because if you make your views "thin" enough (i.e. nothing but dumping a few variables into HTML), on many projects, that makes them the kind of thing that can/should be edited and adjusted by people outside the dev team. If they're in the DB, you can easily do that and wrap workflow etc as well. Commented Nov 7, 2008 at 15:04

1 Answer 1

1

ASP.NET MVC is a type of Web Application project. Thus all the code-behind is compiled into an assembly before deployment. It's not like a WebSite project when at the time of the request, the code-behind is compiled.

What that means is that your views have an "Inherits" declaration. The type that they inherit must exist somewhere. If your pages inherit from ViewPage, you're set. If they inherit from ViewPage of T, then you've got issues. The CLR syntax for defining a generic type is ugly. Check out this post for more info.

Here's an example of the syntax:

System.Web.Mvc.ViewPage`1[ [System.Int32,mscorlib] ]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.