views:

141

answers:

7

I'm trying to tackle the problem of disconnected operation for an application with a relatively rich data layer, and it occurs to me that the most natural way to make this work is with a client-side database. I don't want to have to install a separate product, however, and I'm left to wonder if there are any layers out there where you can essentially link a database-like persistence layer into an application. Has anyone had any experience with this? Are there any good frameworks that cover this area?

+6  A: 

I would recommend SQLite. It's a full SQL database engine wrapped in a single dll with no installation or maintenance that just ships with your app and runs in-process. There's a great .NET wrapper that integrates nicely and allows you to create custom functions in .NET.

http://sqlite.phxsoftware.com/

Sam
This looks like pretty much exactly what I was thinking about.
Mike Burton
+2  A: 

You can use NHibernate with sqlite or sqlce database. We use sqlce.

Sergey Mirvoda
+2  A: 

.Net has strongly typed datasets, which work great for this purpose. http://msdn.microsoft.com/en-us/library/esbykkzb%28VS.71%29.aspx

dcp
+2  A: 

Even thought you don't want to install another product, you might want to consider SQL Server Compact Edition. Although you do need to install it, it's free, and installs no new Windows services.

The databases themselves are simply a single file per database. LINQ to SQL and LINQ to Entities are still supported, and you can even get a Windows Mobile version.

Mark Seemann
I'm not sure what you mean by "install". All SQL CE needs is a handful of DLLs, and those can be included with the client as private assemblies. There is no need to run a separate installation.
McKenzieG1
Technically, this may be possible, but legally, you may not be entitled to redistribute Microsoft's dlls. It's not open source... To be honest, I don't know if this is the case, but if you want to redistribute binaries, you should have a lawyer look into it - no matter who the vendor is.
Mark Seemann
+3  A: 

If you don't need the power of a relational database and want to simplify translation of your object model for persistence, you should look into DB4O - it's an object database that can run on your client and transparently persist your classes.

LBushkin
I second that. I was using it in a couple of personal projects and it feels great. Check this tutorial to see what it is capable of and if it would be suitable for your needs: http://www.db4o.com/about/productinformation/resources/db4o-7.4-tutorial-net.pdf
Audrius
+1  A: 

Are you looking for a database-like persistence layer because you want the query power of a database on the client side, or for persistence between application runs, or both?

If you need both, or just the persistence, then any one of the other answers showcasing integrated DB libraries will do (like this one for SQL Lite).

However, if the only thing you need is the ability to perform complex queries against in-memory data then I would highly recommend using plain-ol LINQ-to-Objects, assuming the option is available to you.

casperOne
I'm looking for a layer that looks like a database because I already have a large database in operation and I'd like to at least explore the option of mirroring that structure on the client. Having said that, I've already been informed that they tried small client side databases in the past using client installs of SQL Server Express and it turned out to be nightmarish. So my next step is to see how close I can get without going that far.
Mike Burton
+1  A: 

You can try siaqodb - http://siaqodb.com , has small footprint, very fast, LINQ query engine and you can use Import/Export from XML if you want to Sync data with server side

sqo