开发者

Local File-type Datastore for Winforms

开发者 https://www.devze.com 2022-12-29 03:23 出处:网络
I hope my title is not misleading, but what I\'m looking for is a file-type datastore for a Winforms app (.NET 3.5) that will allow me to:

I hope my title is not misleading, but what I'm looking for is a file-type datastore for a Winforms app (.NET 3.5) that will allow me to:

  1. store/retrieve strings and decimal numbers (only);
  2. open and save it to a file with a custom extension (like: *.abc); and
  3. have some relational data mapping.

Basically, the application should allow me to create a new file with my custom extension (I am au fait with handling file-associations), and then save into this file data based on functionality determined by the application itself. Similar to when you would create a Word document, except that this file should also be able to store relational data.

An elementary example:

  • the "file" represents a person's car
  • every car will have standard data that will apply to it - Make, Model, Year, Color, e开发者_运维知识库tc.
  • However, each car may have self-determined categories associated with it such as: Mechanic History, In-Car Entertainment History, Modifications History, etc.
  • From the data stored in this "file", the person can then generate a comprehensive report on the car.

I realise that the above example could easily warrant using an embedded DB like SQLCE (SQL server compact edition), but this time around I want to be able to create datastores that can move with people, assuming that this application resides on more than one computer (eg. Work and Home).

I'm unsure if XML is the option to go with here, as the relational data-mapping may pose a problem. In theory I envision having a pre-defined data-model, and create a new SQLCE-type database (the "file") to which the data can be persisted to and retrieved from. File-size is not an issue, as long as it's portable, ie. I can copy it to a flash disk from the office and continue working with it at home.

If my question is still unclear, please let me know and I'll try my best to clarify! I would really appreciate any help in this regard.

THANX A MILLION!!

EDIT: my apologies for the long-winded essay!


Here are a couple of ways you could do this.

  1. XML, DataSets and Linq

    You can use an xml file and load it into a DataSet, then use Linq to query it.

  2. SQLite

    SQLite is a file-based database. You can ship the SQLite dll with your application, needs no install. You can name the files whatever you like, and then access the data using ADO.NET. Here is an ADO.NET provider and sqlite implementation all rolled into one dll: http://sqlite.phxsoftware.com/

0

精彩评论

暂无评论...
验证码 换一张
取 消