Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on a small project which will only have one user at a time since it's a local application (developed in WPF and C#). To store data I was thinking of using an XML file but I'm wondering if this would be the best approach.

What the data is for:

  • Shedules
  • Library of files in folders (with Artist name, Title, Location on HDD)
  • Possibly statistics based on the shedule data
  • ...

Information regarding the library would be fine in XML I imagine but about all the rest I'm not so sure. Also LINQ to SQL seems to be alot more profitable in terms of development speed than LINQ to XML. Is this correct or am I wrong? I was unsure if I should post this on SO or here but it seemed more appropriate here!

Thank you in advance

share|improve this question
"One user at a time" is code speak for "in six months it will be our sole revenue stream and need to support 4,000 simultaneous users". Plan accordingly :) – insta Aug 17 '11 at 22:04
You don't even have to run a sql server service, you could just make it a file attached database if you're worried about migrating from machine to machine. – Peter Smith Aug 17 '11 at 22:25
no matter what you choose make an abstraction layer so you can easily swap out to another scheme when it becomes necessary – ratchet freak Aug 17 '11 at 22:27
up vote 12 down vote accepted

If you will be doing lots of IO, SQL is your better choice. SQL is designed to work well to get/store data which is why we use it for storing data on something like a website as opposed to XML.

XML is good for human readable data that can be shared and interpreted between applications, as was its intention. XML parsing involves LOTS of string manipulation which can be come ever costly as the size of the data set increases.

share|improve this answer
Thank you, I'll start using SQL then for this project! – Citroenfris Aug 17 '11 at 22:04
Don't forget the Compact Edition. – JeffO Aug 18 '11 at 1:08

It sounds as if your data could potentially grow infinitely (unless I misunderstood your application). In which case, I would say it's best to leave persistant storage up to a database engine for efficiency and performance.

share|improve this answer
You make a valid point! Thanks for the help. – Citroenfris Aug 17 '11 at 21:57

Go with the database approach. It is the proven technology to handle data.

On the performance issue, you may be able to speed your access by having indexes, where in XML, no such means exist.

On a database, you can calculate statistical data using aggregate functions, in XML you got to code that.

Using a database, you can change the database structure with relative ease (add column, table, etc.) and there are tools to help you move the data between databases, where as in XML you got to do that yourself.

In a database, you can enforce integrity rules and you can let the users write their own selects if needed, not quite easy in XML.

In database, you can sort data very easily, also you can add security. Using a database, you can forget about size and concurrency, so in the future, your application can grow without code changes.

For the above, use a database! EK

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.