ASP.NET MVC3 Razor: how to follow a modular architecture?

Can someone tell me how to follow the modular architecture and create MVC3 Razor views and controllers in a separate class library project?

enter image description here

I find this a very common requirement for developing business applications. I checked the Post Plug-in Architecture for ASP.NET MVC post, but it does not work for MVC3 Razor views. The error message gets confused: "view was not found ... or its master was not found or the viewer does not support the locations found. The following locations were found: ....". I do not know if there can be a view / _ViewStart view. I also checked the Post plugin framework with ASP.NET MVC3 and Razor built-in views , but it does not give any sample code.

Umbraco CMS http://umbraco.codeplex.com/ implements a plug-in architecture, but this is too heavy a structure for my project.

Can someone give a small sample to show how to follow the modular architecture and create MVC3 Razor views and controllers in a separate class library project? thanks in adv.

+4
source share
1 answer

Have you tried using the David Ebbos razor generator, which allows you to pre-combine the razor types in a separate project? Link here . The website also has an example application.

Basically, this allows you to create views in a separate project, and then precompile them by installing a custom control for each view to point to the Razor generator. The project also includes a pre-compiled viewer that will search for you in another project.

+3
source

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


All Articles