Reputation: 13839
I'm building a WPF app that contains a form with "standard" inputs (controls like TextBoxes, RadioButtons,etc). If I need to store the form's data locally, what do you think is the most straightforward way to do it ?
Thanks.
Upvotes: 2
Views: 4816
Reputation: 9443
I think its going to depend on what you need to do with the data. If you are just wanting to persist the state of forms then you could use the Memory Mapped Files feature of .Net 4 (If you can't use .Net 4 then some other serialization format would probably work as well, you would just have to manage serialization/deserialization).
If you need to do any sort of complex operations on the data after it is in the application, then I would say go with something like SQLite or Sql Server Compact (which would give you Linq support if you like that kind of thing).
Another option that would be a sort of middle ground might be a Key-Value store. I don't know of many that are implemented in .Net, but Ayende created one which you can find at GitHub. I have actually used it in the past, and found it pretty easy to get set up and use.
Upvotes: 0
Reputation: 244777
Another option would be to use SQLite or similar embedded database that doesn't have to be installed.
Upvotes: 1
Reputation: 184506
I would say XML-serialization is most straightforward, it requires no additional database and your average CLR-objects can be serialized right away. I use it for settings files and other stuff but would not recommend it for huge datasets because of all the overhead (cannot really tell you what qualifies as too large, it also depends on how often you need to store/retrieve the data).
Upvotes: 1