DShorty
DShorty

Reputation: 582

MVC6 Load razor views from database

We are working on ASP.NET MVC 6 project and it's necessary to load and then compile Razor views from an external source (Azure document database).

I see in other SO posts (<= MVC 5) it was possible to create and register a custom VirtualPathProvider which can take view content from DB or resource DLLs (for example).

What are the options for MVC 6 ?

Upvotes: 1

Views: 962

Answers (2)

Simon Bull
Simon Bull

Reputation: 881

A bit late to the party, but if you are still looking at this I have just posted a sample project to GitHub showing how to store your .cshtml in Azure Blob storage using ASP.NET 5 / MVC 6.

@Maxime Rouiller - MVP is correct that you need to provide a custom IFileProvider. My sample is using rc1-final and working. Looking at the aspnet project though, this may change subtly later (will allow multiple providers to be registered)

A blog post write up on this should be coming in the next few days too.

Upvotes: 0

Maxime Rouiller
Maxime Rouiller

Reputation: 13699

Technically not implemented yet. This is after all a rewrite and not just a set of new features.

I found a thread on GitHub which talk about a way to get what you need.

Basically, it's about providing your own implementation of IFileProvider.

I have virtually no experience in implementing this but I think that if you have time to spare, this is definitely the way to go.

Upvotes: 2

Related Questions