Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing ASP.Net MVC Views in the Database

For an ASP.Net MVC application, I'm interested in storing some views and/or partial views in the database so that a few semi-technical users can do some basic view logic. Does anyone have any tips or lessons from experience on doing this?

I know Phil Haack wrote a blog post on this about a year ago. He used IronRuby for scripting his views, (which would be fine for me). He created a quick proof-of-concept, but I can't find any other information on the topic.

Any ideas, thoughts, tips, etc would be appreciated.

Thanks!

like image 731
Adam Albrecht Avatar asked Mar 16 '10 18:03

Adam Albrecht


People also ask

How can store data in database in ASP.NET MVC?

Select “ Web application (Model-View-Controller)” template and press OK to create Asp.Net Core MVC project. Right-click on the solution and add a new folder named “Models”. Now, add a new class on the Models folder. Right-click on Models folder and select "Add a new class".

How I can save data in SQL using MVC?

Right-click on Model then select New Item > Data template (ADO.NET Entity Data Model). Name your model “MyModel” then select Generate From Database then enter your configuration then select your table. I have created tblStud as in the following: USE [comm]


1 Answers

Here you go. All that you need is to write a custom VirtualPathProvider and register it within the ASP.NET hosting environment. Works also with classic WebForms.

like image 115
Darin Dimitrov Avatar answered Sep 22 '22 16:09

Darin Dimitrov