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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:59:49+00:00 2026-05-16T02:59:49+00:00

I am trying to put together a simple POC for a n-layer application using

  • 0

I am trying to put together a simple POC for a n-layer application using EF4 in the data tier. I have looked at numerous examples on the web and it seems to be a common practice to use a DAO or a Repository as the wrapper to an ORM. My understanding that the main difference between the two is that a Repository is more generic and takes IQueryable for example for parameters. I would like (for better of for worse) at this point to stick with simpler DAO objects that will contain fairly specific methods such as GetPersonByFirstName(string name), similarly to what has been done before with ADO.NET based stuff. That said, I still need several “cross-cutting” features for my DAOs.

  1. How do I go about sharing the context between DAOs? Preferably this would be in a way where the business object instantiating the DAO wouldn’t have knowledge of EF. Initially I was thinking that the BO will be passing the session along to the DAOs but that will violate my requirement of the BO being independent of EF (unless I am not thinking of something). Maybe some sort of Singleton/Factory approach?
  2. Is there a more elegant way to handle this for ASP.NET applications using the request context? Basically a session-per-request type setup, but without having to modify any of the presentation tier code.
  3. I imagine I might have a base class DAO with very basic CRUD methods that will be shared across all DAOs, but again not to the point of IQueryable.
  4. I would like to use TransactionScope within my business object to wrap my DAO (I don’t see this being an issue).

Thank you!

  • 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-16T02:59:50+00:00Added an answer on May 16, 2026 at 2:59 am

    After doing some more research it seems that I am on the right track of storing the Entity Framework context in httpContext.Items. There are plenty of solutions out there that basically create a factory that manages the lifetime of the EF context that way. My main issue with that solution is that my libraries wouldn’t work non-web projects, so I think I need to go down the path of using an IoC container (instead of the factory) to inject the context for me with the lifetime of object-per-request. This way if I need to use my libraries in a console application for example I could change the configuration to something like object-per-thread etc.

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

Sidebar

Related Questions

I am trying to make put together a simple application to control the phone
Trying to do a simple web app with jquery mobile. I have put together
I'm trying to put together a simple table that shows my model's data. I
I'm trying to put together (what I thought was) a simple ASP.NET web application
I'm trying to put together a simple RSS widget (for my wordpress blog) that
I'm trying to put together a layout using Bootstrap that resembles your typical OS
I'm trying to put together a very simple REST-style interface for communicating with our
I'm trying to put together a really simple module with one .py source file
I am trying to put together a simple proof of concept with a Pinterest
I'm trying to put together a simple RSS reader, and found code on http://www.ibm.com/developerworks/opensource/library/x-android/

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.