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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:31:23+00:00 2026-05-22T20:31:23+00:00

A question regarding the repository pattern and query object pattern. I’m using EF 4

  • 0

A question regarding the repository pattern and query object pattern. I’m using EF 4 and have generated my POCO classes from my database model using the ADO.NET POCO Entity Generator in VS 2010. The edmx file and the tt file (POCO classes) are in 2 different projects.

My repositories are domain specific, e.g DocumentRepository and UserRepository. My database model differs from my domain model in such a degree that I have implemented mappers in order to translate a domain object to one or more database tables (and vice versa). One example is that my Document domain class is modeled as 3 tables (and therefore POCO classes) in the database.

How would you implement the query object pattern when using domain objects in such a case? The way I see it I’ll have to write the query object base on the POCO classes and not the domain classes? But wouldn’t that break the repository pattern?

  • 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-22T20:31:23+00:00Added an answer on May 22, 2026 at 8:31 pm

    ORM is usually used in the way that it works directly with domain objects = it loads them from database and it persist them to database. You are doing one more abstraction step where you are using ORM entities only to fill your custom objects. Your custom objects are completely out of scope of your ORM tool and you cannot expect that ORM tool will provide you any support for queries build on top of your domain objects. You must built your own query support and translate domain queries to ORM queries inside your repositories. This is usually done by implementing Specification pattern.

    Btw. in such scenario POCOs doesn’t make too much sense – POCOs are for scenarios where you want to use them as domain objects).

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

Sidebar

Related Questions

I have a question regarding DDD and the repository pattern. Say I have a
I have a question regarding location of repository access. Is it acceptable practice to
I have a somewhat ridiculous question regarding DDD, Repository Patterns and ORM. In this
I recently posted a question which was answered by Bryan Watts, regarding generic repository
A question regarding a DB development project. The database already exist and is rather
I have a question regarding the two additional columns (timeCreated, timeLastUpdated) for each record
I have a question regarding an update function I created... CREATE OR REPLACE FUNCTION
I have a couple questions regarding using the entity manager in a JavaSE environment.
I have a question regarding the proper workflow of git in a PHP/MySQL workflow.
After reading on the benefits (and using) the Repository Design pattern within an ASP.NET

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.