Reputation: 970
The process of setting up a database server is far too complicated for my programs needs, not to mention expensive, and I wish to use local files as a stopgap measure until our webapp can be deployed.
I'd ideally like to use three files - one for the item database with the primary key, one for upcoming conditions, and one for archived conditions. Using a text file would be time and memory consuming, however I am intrigued by the usage of XML. Is this something XML can do? Or, should I look at some sort of simple table (consequently, is there a table as such)?
I only use local files because of the super small scale in question; for example my primary table has three columns and twelve rows. At the very most, the upcoming conditions table will have around five hundred rows, and the archived conditions table will rarely be accessed.
I cannot use an alternative to MS-SQL - it is not supported within my company. This forbids Express, CE, LocalDb etc.
I cannot install MS-SQL on the target machines, there is not enough to cover their licenses. We are not allowed to use Express.
Upvotes: 0
Views: 35
Reputation: 19141
First of all: I'm not sure why you would think XML might be a good alternative if you think a text-file would be too time- and memory-consuming (xml is text based, after all).
Anyway, another option might be to simply create your needed structure (or structures) in C# as one or more objects, and serialize these to a file. For instance, you might create three dictionary-objects to contain the data you mention, then include all of these as members in a data container class.
Now you can serialize an instance of this class to a file. Check for the existence of such a file, or create a new instance if needed next time you run the program.
As long as this is only used within your own application, this aught to work well enough.
Update: Serializing an object basically means that the data contained in a .Net object is converted into a format which can be stored on a drive, for example. You can serialize to various formats - including "plain text", and XML. When an object has been saved this way, you may be able to open the file in a text editor and see and understand the basic structure. You can retrieve and recreate a stored object by deserializing such a file.
Example result from a quick search: Serialize an object to string
Upvotes: 1