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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:52:22+00:00 2026-05-25T05:52:22+00:00

I have a specific scenario that I am wondering if (and how) Entity Framework

  • 0

I have a specific scenario that I am wondering if (and how) Entity Framework might be able to solve.

I am developing the framework for a new solution that will be passed on to many developers to extend and enhance over time. I would like to provide a simple data access layer that they can leverage from the domain layer they are implementing without requiring them to make changes to the data access code. I’m investigating different tools, such as NHibernate, LINQ-to-SQL, EF as well as good old ADO.NET.

As an example of what I’m after, using LINQ-to-SQL, code in the domain layer would call the GetTable<T> method on the L2S DataContext which returns an IQueryable<T>. Theoretically, this means that the DataContext can resolve a request for any T. Of course, in reality, the DataContext has to know how handle T.

Looking at how EF works, I see some parallels to the other tools but can’t quite find how I could accomplish my goals. Here’s what I’d like to have happen:

I provide a default “context” that exposes a method like GetTable<T> (e.g. Query<T>) that returns IQueryable<T>. This allows for future enhancements where T represents EntityTypes that haven’t been implemented yet and makes it easy for developers to focus on the domain layer because all they ever need to do is call GetTable<T> (or similar).

The only other requirement on the domain developer is to provide the mapping layer where the conceptual layer (T) is mapped to the storage layer (the physical database schema).

FWIW, I believe this is easily accomplished with NHibernate via mapping XML files. Is there a way to make this work with EF?

  • 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-25T05:52:22+00:00Added an answer on May 25, 2026 at 5:52 am

    Lots of questions that deal with this same topic. They don’t discuss the pros and cons of EF vs NHiberate etc, but it is very easy to create a very generic data access layer with EF.

    http://elegantcode.com/2009/12/15/entity-framework-ef4-generic-repository-and-unit-of-work-prototype/

    Generic repository implementation with EF

    Entity Framework Generic Repository

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

Sidebar

Related Questions

I have a specific scenario that I want to solve. I currently connect to
Here's my scenario: I have a simple stored procedure that removes a specific set
I have a live web application that is failing in one specific scenario, and
Skip to the specific question as needed. Some background: The scenario: I have a
I have a specific changeset that I want to rollback my Development branch to,
I have a specific requirement that all children of a particular JComponent have double
I have a specific question, that could use a general answer... When building Multi-Tier
I have a specific Silverlight application, that is fed with data by a WCF-Service.
I have a scenario that i suspect is very common, i've found various ideas
I have now a scenario that needs to add and remove items in multi-threading

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.