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 9014565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:32:24+00:00 2026-06-16T03:32:24+00:00

I am using Entity Framework Model-First with Repository and Unit of Work patterns, the

  • 0

I am using Entity Framework Model-First with Repository and Unit of Work patterns, the repositories return EF POCOs.

I assumed that I couldn’t add behaviour to my POCOs that are generated by Entity Framework, so my code is now full of things like XyzService which is a separate class implementing the business logic for the Entity Framework generated Xyz POCO.

I have the following questions:

  1. This has a bad code smell as not only do I have the EF POCOs, I have a service for each POCO. In addition to lots of classes, business logic is split outside of the business entity. Is this an example of the anaemic anti-pattern?

  2. If I stick with EF, is there any way I can add behaviour (i.e. through partial classes) or other means?

  3. Seeing the persistent ignorant patterns which use return business entities from data layer (in our case a repository), if I wanted to go from EF-MODEL -> REPOSITORY-DAL -> BIZ-ENTITY I see there would be a lot of two way mapping between the business entity and the EF model POCO. Can utilities such as Automapper gracefully handle complex relationships of nested objects that I am likely to face?

  4. To reduce duplicated business entities with their counterpart EF model entities, would I not be better of removing EF and just writing my own repository implementations using LINQ to SQL for each repository?

  5. Any recommended way that allows me to concentrate on the code (rather than target fixating on the EF model first as I have been), then still use Entity Framework at the end when I am ready to write the persistence layer, but avoiding a lot of extra work and mapping in doing so? Would EF Code-First be better in this regard?

If I have missed anything else of other technologies that can aid development (NHibernate for example) then please feel free to mention.

  • 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-06-16T03:32:25+00:00Added an answer on June 16, 2026 at 3:32 am
    1. Yeah, according to Fowler, this is an anti-pattern. I personally don’t find this anti-pattern too offensive, but some people do. Use best judgement here. If it feels wrong and is a pain to deal with, then change it.
    2. Yes. Partial Classes can help with this. You can put behaviors in the partials you write.
    3. Yes, Automapper will automatically deal with nested objects if they have a mapping setup
    4. Again, thats up to you. If EF is driving you nuts, don’t use it. Use what works and what makes you feel good while you use it.
    5. Code first was built for exactly this.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Entity Framework 4. I am using a database first model, meaning that
Using Entity Framework 4 and code first how would I create a model that
I am creating a new database model using Entity Framework 4.3 Code-FIrst; using Fluent
I am getting started with Entity Framework 4, using model-first development. I am building
I am getting started with Entity Framework using POCO in a model-first configuration. I
I've tried using Entity Framework Code First and set AutomaticMigrationsEnabled to true so that
I've created a database model with model-first method using Entity Framework 4.0. I then
I have built up a code-first model using Entity Framework 5. The classes have
I'm using Entity Framework 4 with the Model First approach. I started the project,
I've project using Entity Framework 5 Code First, WebApi, ASPNET MVC 4, Repository and

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.