Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

how to convert observable collection to dataTable

Posted on 2011-09-21
3
3,831 Views
Last Modified: 2013-11-12
I want to convert my updated/changed observable collection to datatable to save back into the database. I only want to save the newly updated values in the collection.
Please help, I am using MVVM pattern.
0
Comment
Question by:Masterabhi
3 Comments
 
LVL 4

Accepted Solution

by:
theHollow earned 500 total points
ID: 36579140
Hello
There are many ways of managing this. But I believe that MVVM does not have anything to do with this. This is (in my opinion) something that will be coded the same in WPF (with or without the MVVM pattern) and Windows.Forms.

You could build your own layer and convert from custom classes to your database tables.
Or you could build your own generic layer/provider that does this automatically.
That is called an ORM (Object Relation Model).

Or you can concider using solutions that are already made.

I found this article about the "NHibernate" ORM:
http://www.developer.com/net/asp/article.php/3709346/Using-NHibernate-as-an-ORM-Solution-for-NET.htm

You can check it out. I hope it helps you a bit :-)
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 36597357
Data tables not been included in Silverlight , so as to keep it light. The ideal way to handle is as theHollow had said use and ORM like EF4, which can generate objects which can be directly consumed in SL.

Putting custom code in to simulate a data table would be really costly. If there is no other option but to have data table one method would be to generate an xml of the data table and send it to the service and then deserialzie there and get the data table.
0
 

Author Closing Comment

by:Masterabhi
ID: 36958992
Thanks.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question