• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4366
  • Last Modified:

how to convert observable collection to dataTable

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
Masterabhi
Asked:
Masterabhi
1 Solution
 
theHollowCommented:
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
 
Gautham JanardhanCommented:
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
 
MasterabhiAuthor Commented:
Thanks.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Tackle projects and never again get stuck behind a technical roadblock.
Join Now