Solved

how to convert observable collection to dataTable

Posted on 2011-09-21
3
3,609 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now