tags:

views:

129

answers:

4

Hey, what's the easiest way to use a file-based database with LINQ in C#? It would be best if I could use it without installing extra components.

EDIT: I want to use it for a file index. Not the whole file system, but the database should be not too slow and not too big.

A: 

Are you opposed to using XML?

That's basically what XML is (or, rather, is a major use of XML), and Linq to XML is very powerful.

JoshJordan
A: 

The way i've implemented this kind of thing previously is to load a csv file into a C# List structure (couldn't say which is best without information on the data), and use Linq to access data from there.

This may not be the best solution for you, but you have given limited information on what you're looking for.

Jimmeh
A: 

You will always need to install database drivers to talk to a specific database. The only way to avoid that is to create your own driver to talk to a database, or even create your own database engine.

However, both SQLite and VistaDB have LINQ to SQL now. Other alternatives are to use a text file or XML file for your "database."

hectorsosajr
+2  A: 

I'd recommend MS SQL Server Compact Edition. Its embedable, small footprint, good performance and you can use Linq2Sql to query it easily. Also it integrates well with Visual Studio IDE and SQL Management Studio.

Ray