amaz
amaz

Reputation: 445

MVC3 MongoDB Project Architecture

We are starting new project which is going to use MVC3 and mongoDB for Database storage. Could anyone point us towards better Project architecture.

We have following queries:

  1. Can we have Project.Data (for data access to mongoDB), Project.WEB.UI(MVC), Project.Core (Business logics) - 3 projects in Visual studio solution file ?
  2. Where to have model classes ? in Project.Core ? how to share the model between those projects ?
  3. If anyone has these kind of architecture and have some sample classes and interface (in VS project file), Please share that for me
  4. We need to have data models as well to interact with mongodb? where to put these models ? can we share these models across all projects ? Any working code is highly appreciated.

Note: I have seen few other SO question already and those are not answering my questions directly.

Thanks in advance.

Upvotes: 0

Views: 256

Answers (1)

Joe
Joe

Reputation: 386

On a project I've worked on we ended up combining what you have as Core and Data. Initially we went for a full separation of concerns with business logic in our Services and a DAL which had the Mongo queries. Because when you're working with MongoDB its pretty different to working with a RDBMS we found much of our business logic was written in a way that made it Mongo specific, so we combined the layers as it seemed we pretty much had a redundant layer, and if we did decide to go back to an RDBMS we'd likely rewrite some of the logic.

As for your questions your Domain objects are your Mongo entities so I'd put those in your data layer. I'd then have your MVC model in your WEB project and use Automapper to map between them.

Upvotes: 1

Related Questions