MVC6 Loading razors from a database

We are working on an ASP.NET MVC 6 project, and you need to download and then compile Razor views from an external source (Azure Database).

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

What are the options for MVC 6?

+1
source share
2 answers

Technically not yet implemented. This is, after all, a rewrite, not just a bunch of new features.

I found a thread on GitHub that talks about a way to get what you need.

Basically, about providing your own implementation of IFileProvider .

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

+2
source

A bit late for the party, but if you are still looking at it, I just posted a sample GitHub project, 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 uses rc1-final and works. However, looking at the aspnet project, this may change later (allowing multiple providers to register)

A blog post that this should appear in the next few days.

0
source

Source: https://habr.com/ru/post/984820/


All Articles