简体   繁体   中英

MVC project architecture supporting modules

I need my MVC 3.0 project to support modules. By module I mean having separate library which includes models views and controlers. The reason for this is to have reusable parts of application which can be used by multiple applications.

The best for me would be to have those modules as an mvc applications - to have resharper, mvc visual studio addons working. I mean intellisense, controler navigation, view and controler creation screens etc. If I inlcude those classes in general class libraty, the functionality is gone.

setting the application to use my controllers from "module" application is fairly simple.

    routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            , new[] { "ModuleApplication1.Controllers" }
        );

the problem is that the view, the controller is trying to load is not present in current application, but it's in my "module" application. Even worse - the views are not compiled nor embedded in the dll at all. I don't wont to copy them. I prefer to load them from the dll. If it's possible.

I admit, I'm new to MVC.

Am I missing something? Is there any solution to this? Is my approach totally wrong?

您可以使用MvcContrib便携式区域,它们是专门为这种情况而设计的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM