Answer the question
In order to leave comments, you need to log in
How to properly split an ASP.NET MVC application into multiple projects (modules)?
There is a web portal, which consists of many almost independent sections (the only thing that connects them is the user database): blogs, questions, forums, news, etc.
Naturally, all this in a single project is rather inconvenient to maintain.
I would like to break the project into sections. What is the best way to organize this? All that I found on the net is crutches on crutches.
Currently (MVC 5), controllers are grabbed from the .dll as well as from the App_Code folder.
But the problem of routing collisions arises, the names of the views match .... I
thought to do this:
1. Define the naming rules for modules and the storage folder *~/Modules/")
2. Each module stores its views in this folder and from the code explicitly they are accessed (return View("~/Modules/ModuleName/..."))
3. Give controllers long names containing the name of the module, and on the site itself simply inherit from them, thereby getting a route, as well as the ability to have multiple instances of the module.
I tried several other options, but I don't like everything. Isn't there a normal way to create a modular application where the modules won't be linked directly?
UPD (10/20/2015):
in clause 3, controllers can simply be made abstract.
views and all other files can be added to resources (and ideally they need to be unpacked, and also given the opportunity to override something in the using application).
Answer the question
In order to leave comments, you need to log in
And you did not think to use regions (Areas)? This will give another level of routing, which can solve the problem of collisions, and when creating a route, specify the assemblies that store the controllers
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question