Should I Use XML files or a Database?
I have an XML response from the Google Directions API and want to cache the request so that the next time the us开发者_如何学JAVAer queries the same path, I return it from a local cache. I am using the XML format returned by the Directions API which has data separated in tags of which would be rows and every tag inside forms a column (if I consider a database approach).
My question is, should I separate the data into a database each time a request is made, query if the data already exists and then proceed, or use XML to store the data?
If using a database, which is the best database to use with a WPF application? If XML, how to go about storing the fies?
My priority is the responsiveness of the application i.e it should not get too heavy after doing this.
I would suggest using XML. Use XML Serialization to persist the information. You can save the file to isolated storage via XML serialization.
I would suggest deserialization and storing the cached result in a DB with small footprint. For instance sqlite - http://www.sqlite.org/ - would be a perfect candidate for the task as the data is not shared. And as it has ADO.NET provider: http://sqlite.phxsoftware.com/forums/default.aspx?GroupID=2 it can be used with WPF.
It depends on the volumetrics. You haven't given any numbers - amount of data, throughput, response time, project timescales and budget. You can't make decisions on technology choices without numbers.
精彩评论