Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6861783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:34:47+00:00 2026-05-27T02:34:47+00:00

I am setting up an MVC solution and trying to seperate it out into

  • 0

I am setting up an MVC solution and trying to seperate it out into logical projects. So far, I have the following projects:

  • MVC (presentation layer, Models folder contains only ViewModels)
  • Services (provides business logic, has interfaces and providers folders)
  • Repository (for persistence, has interfaces and providers folders)
  • Domain (POCO)

The mvc layer references the service layer and service references the repo. All three reference the Domain so that I can pass the POCOs between them.

Does this setup make sense in that I could potentially use a different presentation layer in the future which would again work via the service layer?

At the other end, would my Domain layer allow me to swap out one ORM for another without breaking? Am I right in thinking that as long as the repo classes in the Repo layer implement interfaces, I could create a new set of concrete repo classes which work with a different ORM?

Sould my DbContext live in the Repo layer with the EF implementations? Is this where a UoW would go?

Can my Services do basic validation using the Annotations on the Domain POCOs or should I use a tool such as Fluent Validation?

Finally (!) would it be correct to create a sepereate Test project for each layer (where appropriate)?

Thanks in advance for all help,

James

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:34:47+00:00Added an answer on May 27, 2026 at 2:34 am

    As long as you make sure that you are developing against an interface, not an implementation this would definitely work.

    We are developing applications with a similar architecture to what you are suggesting.

    Our presentation layer uses MVP so we can share our presenters between ASP.NET Webforms and other frontends. In that we use a ServiceFactory which uses dependency injection to create our services. This could be a WCF client proxy or a direct service. The presenter doesn’t need to now if the call is going over WCF or directly.

    In our Service layer we use a UnitOfWork that wraps a set of Repositories. The UoW is also constructed trough DI.

    We use the Entity Framework and generate POCO objects from it. We only choose to not share the POCO’s all the way to the presentation/view layer but only in the business and service layer. From the service layer to view we use custom DTO’s. Currently EF and the UoW live in the same project. We could move them to another assembly and load them from there but in practice it wouldn’t make any difference (and we want to avoid the whole ‘number of projects’ explosion each time we load the solution file).

    We perform our validation partly in the POCO entities and in the Service Layer (which maps the DTO’s to the POCO’s and can check the data). Also we validate incoming data in the presenter and in javascript in the view (for a nice user experience). We currently don’t use a tool for the validation.

    And yes, we have a test project for each layer.
    We test the Presenters, Services and the UoW/Repositories. On our build server we run continues integration which runs all unit tests in a couple of different setups (in memory, against the database, using WCF).

    Off course if you would only test your Presenters this would also hit the services and the datalayer but if you mock all dependencies you can test each layer in isolation (especially for the cases where another layer should trow an error or something, which is a lot easier to do when you mock the whole layer).

    The only thing I’m currently looking at is testing the actual views. We’re currently not testing them in automatic way. Maybe we’re going to use Coded UI tests or some javascript framework.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following projects: MVC Console application Class library Windows forms application COM
Setting up ASP.net MVC with Linq2SQL or Entity Framework's context to have scaffolding work
I am setting up an application using the MVC model and I have a
I am playing around with MVC and have started setting up an existing site
how should i load the table Setting into an asp.net mvc so that i
In VS2010 I have two MVC 2 based web apps within the same solution
I have a solution file with two applications loaded. Both are MVC enabled apps,
I have an ASP.NET MVC site which is composed of 3 projects in a
So I have a VS 2010 solution containing one ASP.NET MVC 3 project and
I am developing a webapplication using asp.net mvc 3. In the solution I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.