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

  • Home
  • SEARCH
  • 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 775465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:17:37+00:00 2026-05-14T19:17:37+00:00

What pattern should I use for data-access in case of VS2008 generated L2s or

  • 0

What pattern should I use for data-access in case of VS2008 generated L2s or EF DataModels? Repository-pattern or what?

As we know VS2008 generates Data-Models and DataContexts/ObjectContexts in the same file, then, how should I arrange my VS2008 assemblies in my VS2008 solution to achieve a layered design?

If I use repository pattern, how should I arrange my assemblies in the VS2008 solution (as Data-Models and Data/Object-Contexts are stored in the same file…)?

Any web/example link would be appreciated.

  • 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-14T19:17:38+00:00Added an answer on May 14, 2026 at 7:17 pm

    What I’ve done is to wrap (in my case Linq2Sql) in my own custom class, which implements the repository pattern, here’s the pasted excerpt from a previous but somewhat related answer.

    I’d recommend reading through The Onion Architecture and looking at the MVC StoreFront videos for inspiration. The magic part is, pushing the Linq2Sql part or EF stuff to one side, So you don’t sit on top of it as much as, Pull it in if you want it, that way you could use Linq2Sql or EF or NHibernate. This is more work, but gives you more flexibility.

    Here’s my example CarProject

    In Car.Core project

     public interface ICarRepository
     {
        IQueryable<Car> GetAllCars();
        void Add(Car);
     }
    

    I then have a implementation of the interface which wraps up access to the generated Linq2Sql class.

    Car.Data project

    public class SqlCarRepository : ICarRepository
    {
        private CarDataContext _context;
    
        public SqlCarRepository()
        {
            _context = new CarDataContext();
        }
    
        #region ICarRepository Members
    
        public IQueryable<Car> GetAllCars()
        {
            return _context.Cars;
        }
    

    You could have a EF equivilent ofcourse, or NHibernate.

    I haven’t got all this completely sorted, and I’m still learning but I currently have these projects:

    Car.Core         --- All the interfaces and domain objects, DTO's etc
    Car.Core.Tests   --- The tests of the core business logic.
    Car.Web          --- Asp.net MVC frontend
    Car.Web.Tests    --- Tests for the website
    Car.Data         --- The Linq2Sql stuff lives in here
    Car.Data.Tests   --- The tests for the DAL layer
    

    In your scenario you could either put EF in Car.Data or maybe change it to Car.Linq2Sql and Car.EntityFramework. Not sure what I’d do.

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

Sidebar

Related Questions

I have an application that uses a generic repository pattern for data access. As
I need some advice on what kind of pattern(s) I should use for pushing/pulling
I'm developing a webapp and I'm not sure which pattern design should I use.
I need to serialize access to shared resource(ie Cache). I use pattern described later,
Scenario Data Access Layer EF's generated .edmx and classes Used only to access the
I want to use EF Code First. I'm working with a repository pattern. And
I'm having trouble with grep.. Which four patterns should I use with PHP's preg_grep
I'm trying to figure out if I should continue on with a current pattern
Doctrine2 docs said that soft-delete behavior should be better implemented as a State pattern
In brief: What is the pattern called in the following code, and how should

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.