Do I need to run a server to achieve database-like functionality?
I'm currently trying to develop a program which stores lots of data, similar to an address book, I suppose, with the intent that new data will be periodically added to the program over time.
I know that I could set up a 开发者_如何学CSQL server, and have the program interface with that, but if I want to share my program with other people, I can't guarantee that they'd have access to the server, or that they can set up a server of their own to hold the data.
I also know that I could simply hard-code all of the data into instantiated objects, but that is inelegant, and promises to be incredibly irritating to alter or maintain.
Is there someway I could design the program in such a way that it maintains a database-like structure, yet has no reliance on external programs (such as a SQL server)?
"SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine."
http://www.sqlite.org/
Sure. You can use XML. XML can be also used as a datasource for ASP.NET components, just like a database.
You could use a flat file database like SQLite which is linked in on compile and could be distributed with your code.
You have several options:
- Use flat-file database like SQLite (ADO.NET provider)
- Save your data into a file in some format like XML or CSV, or use binary serialization (or something more elaborate if you don't want to have all the data in memory)
- Have a public SQL server accessible from the internet
Of course these is always SQL Server express from MS for this purpose.
no you do not neet a server. the most flexibel solution would be to use NHibernate with FluentNHibernate.
There are different drivers for different databases like SQlite, MsAccess and also for Server like MsSql, Oracle, ....
精彩评论