Save Customers in Order Management RI

Topics: Web Client Software Factory, User Forum
Apr 30, 2008 at 5:39 PM
I'm emulating the Order Management RI for a web app I'm building. The RI only persists data in the dataset in memory. Is there guidance out there on best practices on how to actually write changes to the underlying .xml file?
Coordinator
Apr 30, 2008 at 10:43 PM
Edited Apr 30, 2008 at 10:45 PM
I think we both explicitly state in the docs and have code comments that say (and I am paraphrasing this with my own spin):
     "This sample uses a dataset and an XML file as its data source.  This is NOT a best practice.  
       It is a sample that can easily be copied, installed, and run by develoeprs without needing to setup a SQL data store, run set scripts, etc.  
       Do not do this in a real application."
Instead, do what we did to start out. We used the patterns & practices: Repository Factory to create an implementation of a repository that talked to a scaled down version of Northwind. We then hacked it to death, replacing the "real world, good practices" version with the DataSet/XML file version. You can just skip that step. :-)
You will probably need to make some changes top match up with the interfaces we ended up with, or you could use what the repository creates, and change the service a bit.

I hope that helps.
Michael Puleio - patterns & practices
Bloghttp://blogs.msdn.com/mpuleio/
May 27, 2008 at 7:37 PM
The changes in the Order Management RI can be persisted in the underlying .xml file using the WriteXml method of the OrdersManagementDataSet dataset. You may implement a Save method in each xxxService class in the OrdersRepository.Services project like this:

public void Save()
{
   repository.WriteXml("OrdersData.xml");
}


Please let me know if this helps.

Jonathan Cisneros
http://staff.southworks.net/blogs/jcisneros/default.aspx