I'm working trying to realize a requirement where the pages should be 'configurable' at runtime (per client), stored in a database - a requirement that I have no say in
Anyway, the current plan is to use the Razor view engine and 'load' the 'pages' dynamically. I have a basic sample working using a VirtualPathProvider and VirtualFile that serves up Razor 'pages' on the fly.
The question I have if there is a better approach when I have the Razor 'pages' stored in a dB (or any other repository)?
There seems to be some constraints and concerns when I check other postings. For example:
'If a Web site is precompiled for deployment, content provided by a VirtualPathProvider instance is not compiled, and no
VirtualPathProvider instances are used by the precompiled site.' (from
http://msdn.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx )
VirtualPathProvider is the way to go, and no, you can't do precompiled sites. Either the site is dynamically updatable from the database or it's precompiled.
ericsson007
Member
3 Points
7 Posts
Razor view engine - 'content' from dB using VirtualPathProvider?!
Dec 14, 2010 12:25 AM|LINK
I'm working trying to realize a requirement where the pages should be 'configurable' at runtime (per client), stored in a database - a requirement that I have no say in
Anyway, the current plan is to use the Razor view engine and 'load' the 'pages' dynamically. I have a basic sample working using a VirtualPathProvider and VirtualFile that serves up Razor 'pages' on the fly.
The question I have if there is a better approach when I have the Razor 'pages' stored in a dB (or any other repository)?
There seems to be some constraints and concerns when I check other postings. For example:
'If a Web site is precompiled for deployment, content provided by a VirtualPathProvider instance is not compiled, and no VirtualPathProvider instances are used by the precompiled site.' (from http://msdn.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx )
Dynamic Razor
marcind
Contributor
3344 Points
609 Posts
Microsoft
Re: Razor view engine - 'content' from dB using VirtualPathProvider?!
Dec 14, 2010 07:03 AM|LINK
VirtualPathProvider is the way to go, and no, you can't do precompiled sites. Either the site is dynamically updatable from the database or it's precompiled.
ASP.NET Team
@marcind
Blog