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

The Archive Base Latest Questions

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

I am long time user of LINQ2SQL, but have not used the Entity Framework

  • 0

I am long time user of LINQ2SQL, but have not used the Entity Framework yet.

One thing that is not possible in LINQ2SQL is to use tracked entities in different data contexts, or ‘link’ objects from different data contexts.

Example:

Foo f = null;

using (var dc = new DB()) 
  f = dc.Foos.Single(x => x.ID = 1);

using (var dc = new DB()) 
{
  var b = new Baz();
  dc.Bazs.InsertOnSubmit(b);
  f.Baz = b;
  dc.SubmitChanges();
}

Note: IIRC, this can work if using disconnected objects (but IMO that is pretty useless).

Today, I saw an article on EF4 implying that the pattern above can be used with EF4.

So the question is: Is this in fact possible?

  • 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-17T02:14:02+00:00Added an answer on May 17, 2026 at 2:14 am

    no you cannot

    you stil lhave to faff about with detaching and attaching to a new data context.
    Invariably you end up doing this by using the unique key for the object to slect it out of the database and then copy the properties into the new object and save the changes back.

    Sad but true.

    I used to be a lin2sql junkie, i do prefer EF4 though after a bit of exposure to it. I like the various forms of inheritance – they can be leveraged to do some interesting things.

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

Sidebar

Related Questions

I'm a long-time ActionScript 2 user, now getting started with ActionScript 3. The one
I'm a long-time emacs user, and I'm now working about 1/2 time in Java.
A long time ago when I was a young lat I used to do
As a long time World of Warcraft player, and a passionate developer I have
Long time listener, first time caller. I'm a full time SE during the day
Long time ago, the Game Developer magazine published an article about ID Software and
A long time ago I had an apple ][ . I remember the command
A long time ago I saw this trick in Ruby. Instead of doing (for
A long time ago I had the following directory structure in my SVN repository
I'm a long time hobbyist programmer interested in getting into web application development. I

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.