WPF Reflections

Feb 27 2008   2:46PM GMT

Save ObservableCollection to Linq for Sql



Posted by: MarkWPF
Tags:
WPF

I described how you create an ObservableCollection from a Linq query (including Linq for Sql amongst others) in a previous post.

A second part of the equation is of course, how do you then save your changes back to the database using Linq?

Of course, you have probrably guessed that it’s not going to be a walk in the park.
What you need to do is go through the object and all sub lists and convert them back into the Linq EntitySet classes. After that they can be saved via SubmitChanges.

Tedious, you bet!
Either I’m missing the point somewhere or the EntityFramework needs to fix this by implementing INotifyCollectionChanged in the EntitySet class

3  Comments on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Mrbiancardi
    is not possible to use LINQ + Microsoft Blend ?
    0 pointsBadges:
    report
  • MarkWPF
    Re: LINQ and Blend You can create a data context binding in Blend and set it to your class that exposes the EntitySet class
    15 pointsBadges:
    report
  • Rachid2008
    hi mark, thank for you wonderful tips. Actually i want to use linq and wpf in my project and i did not found a great tutorial that explain how to bind wpf forms with linq to sql. I mean a CRUD application involving linq to sql and wpf(expression blend). Have you an idea where can i find such tutorials. Thanks very much again for your great solution.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: