I’m working on a small project (not production) where I’m needing to store enough data that something like a CSV would be inefficient to process and an SQL/MySQL server would be too much. Does .Net have any way to efficiently store several entries of data with the ability to query without having to manage and connect to a server rather loading and processing a single file.
8
There are a few alternatives, in no particular order:
- All versions of (paid?) visual studio come with SQL Server Express installed. You can use that.
- (Ugh) XML files
- SQL Server CE (basically, local SQL via file)
- SQLite
More ideas here: https://stackoverflow.com/questions/3639846/what-is-a-good-embedded-database-to-use-with-c
6
In addition to the options Sklivvz offered, don’t be afraid to venture outside of the SQL realm and use an embedded object-oriented database engine, such as Sterling or DB4O.
They offer the advantages of being small and file-based, embeddable into your application, but are also very fast and easy to program to.
SQLite would be your best option.
As written on their site:
SQLite is a software library that implements a self-contained,
serverless, zero-configuration, transactional SQL database engine.
Seems really what you’re looking for!
There’s even a Chocolatey package if you’re too lazy to download and install it yourself!
ADO.NET can serialize to XML and has almost all of the functionality of an RDBMS. (Well, the cheap ones, anyway.)
I know it’s “Old” and looked down on, now, but ADO.NET works really well for exactly what you’re describing. It even does a pretty decent job of tracking non-committed changes.
It may be “Old,” but it’s certainly not “Busted.” It’s got a fairly heavy memory footprint, though, so your call on that. 4000 records won’t be an issue.
3