Mvc – Modular enterprise architecture using MVC and Orchard CMS

Architectureasp.net-mvcdesign-patternsmvc

I'm making a large scale MVC application using Orchard. And I'm going to be separating my logic into modules. I'm also trying to heavily decouple the application for maximum extensibility and testability.

I have a rudimentary understanding of IoC, Repository Pattern, Unit of Work pattern and Service Layer pattern.

I've made myself a diagram. I'm wondering if it is correct and if there is anything I have missed regarding an extensible application.

Note that each module is a separate project.

Architecture diagram


Update

So I have many UI modules that use the db module, that's why they've been split up. There are other services the UI modules will use. The UI modules have been split up because they will be made over time, independent of each other.

Best Answer

Correct in terms of what? Your question is vague so it is hard to answer. I think you may have some misconceptions about what Orchard is. Your diagram shows Orchard as as what seems to be a web server, and it looks like you plan to do all this architecting of your modules, separating ui from db, and using all the patterns you mentioned, etc on top of Orchard. But Orchard already provides all that, Orchard provides a method of data access, dependency injection, content management, versioning, Theming, uses asp.net MVC which is your flavor of MVC, etc. The point of it is that you can use Orchard's existing extensibility to build your application. People using Orchard have even discussed whether or not "framework" might be a better description for Orchard than "CMS", because of all the things it does, and the variety of apps that can be built with it.

There is already a pattern for how to build applications with Orchard, which is different from your diagram. You are free to do your own type of db access, and customize everything, but if you find yourself building a new app from scratch with Orchard, and from the get-go circumventing all the patterns that Orchard provides, you may want to rethink things.

You should read or re-read the documentation at http://orchardproject.net. You will find that to build a site with Orchard you just need to make one or more modules, and a theme. The modules can be as granular as you want, and if you build things the way the Orchard docs suggest, and using existing modules (both core Orchard ones, and 3rd party ones from the gallery) as examples, your app will have a good separation of concerns. You will be able to takes pieces in and out, replacing them with different implementations without too much effect on the rest of the system, etc. If you just follow the docs to build a super simple module, you will have used pretty much all the patterns and architectural concepts you mentioned whether you are aware of it or not.

Related Topic