tags:

views:

5173

answers:

10

What NoSQL solutions are out there for .NET?

Which have the best integration with C#? Which integrate with LINQ? Also which would be easiest to integrate into an application?

+4  A: 

Take a look at db4o. It's object-based, easy, self-contained (like sqlite3) works with LINQ and it's open source.

knoopx
A: 

You might want to check Ayende's Rhino.DHT:

http://github.com/ayende/rhino-dht

http://ayende.com/Blog/category/555.aspx

or the rather new MS project - Velocity: http://www.google.com/search?rlz=1C1CHMB_plPL350PL350&sourceid=chrome&ie=UTF-8&q=microsoft+velocity

Michał Drozdowicz
I believe Velocity is distributed caching, not persistence.
Mr Grieves
+27  A: 

You don't state what your requirements are (i.e. has to run on Windows), so I'll throw out the 2 that I've used successfully.

MongoDB is a document database that has prebuilt binaries for 32bit and 64bit Windows. That's always a nice thing to see.

Client access can be done with this driver. It isn't an official client from the MongoDB team itself, but I've used it. And in my usage, it has supported what I need. There is some LINQ stuff in the repo, but I haven't tried it.

// from the wiki
using MongoDB.Driver; 
Mongo db = new Mongo(); 
db.Connect(); //Connect to localhost on the default port. 
Document query = new Document(); 
query["field1"] = 10; 
Document result = db["tests"]["reads"].FindOne(query); 
db.Disconnect();

I was able to run both client and server on Windows with no problems.

CouchDB is an option as well. There are some native .NET clients, but all of CouchDB is done with REST. So HttpWebRequest/Response will serve you well here. A blog post by Rinat Abdullin shows how some of the pieces fit together. There is also CouchBrowse. I've never used a native client. GET/PUT/POST have worked very well for me.

I got CouchDB to work on Windows (it's written in Erlang), but my performance testing showed that Linux was faster. My guess is maybe in how Erlang itself is implemented? I dunno. But it runs on both Windows and Linux. And I was able to call the Linux instance from Windows easily (it's just REST).

This next one I've never tried, but I've got a friend who is a committer on the HBase project. And he thinks that the Thrift interface to HBase should be usable from .NET (since Thrift will generate C#). The big thing here is the fact that Hadoop/HBase are focused more on *nix environments. But there is no reason you couldn't run HBase on a Linux cluster and connect to it from .NET on Windows for production. For development, you can run HBase on Windows using Cygwin. A good set of instructions on how to do this is here.

There are others (Valdemort, Cassandra, etc.) but I have no real experience with them so I won't pretend to say how they integrate with C#/.NET. The big thing to look at is what their API looks like - if it has a Thrift interface, REST, etc. you should be able to connect to them with no problems. You might not be able to run the NoSQL Service on Windows OS as efficiently as Linux, but maybe that isn't a big deal.

EDIT Changed that there are some native CouchDB clients. I'm not familiar with them as I always use raw HTTP and my own little wrapper classes.

Justin Rudd
+3  A: 

db4o is great, but be aware that it has an open source version, but it is not free for commercial use.

Fehaar
+7  A: 

You also should consider using Redis. It's an advanced NoSQL database with support for rich server-side data structures such as lists, sets, sorted sets and hashes. It is also one of the fastest NoSQL databases around: 110000 SETs/second, 81000 GETs/second in an entry level Linux box. Check the benchmarks.

I have a feature-rich open source C# client that let's you persist any C# POCO type natively available at: http://code.google.com/p/servicestack/wiki/ServiceStackRedis

The client provides a rich interface providing wrappers for .NET's generic IList, IDictionary and ICollection for Redis's rich server side data structures.

If you want to view a good tutorial on how you can use it to develop a real-world application check out: http://code.google.com/p/servicestack/wiki/DesigningNoSqlDatabase

Here's an example from the page above showing how easy it is to store and retrieve C# objects:

var redis = new RedisClient();
using (var redisUsers = redisClient.GetTypedClient<User>())
{
    redisUsers.Store(new User { Id = redisUsers.GetNextSequence(), Name = "ayende" });
    redisUsers.Store(new User { Id = redisUsers.GetNextSequence(), Name = "mythz" });

    var allUsers = redisUsers.GetAll();

    Console.WriteLine(allUsers.Dump());
}
/*Output
[
    {
        Id: 1,
        Name: ayende,
        BlogIds: []
    },
    {
        Id: 2,
        Name: mythz,
        BlogIds: []
    }
]
 */

Although the server is primarily developed on Linux I have windows redis-server builds available at: http://code.google.com/p/servicestack/wiki/RedisWindowsDownload

mythz
+15  A: 
haarrrgh
and costs a small fortune to use!!
Keith Nicholas
I don't *think* you have to pay unless you are redistributing the library with your app (i.e. having it running on commercial website is fine...)
Christopher Edwards
I'm not sure if you're right, Christopher. The licensing page (http://ravendb.net/licensing) says: "You can use Raven for free, if your project is Open Source. If you want to use Raven in to build commercial software, you must buy a commercial license." It doesn't mention commercial websites specifically, but as I understand it, as it's not open source, it's commercial, so you have to pay for it.
haarrrgh
True, but I think "small fortune" is overstating it. It's less than the cost of a Visual Studio license...
Paul
The price was higher at the beginning...I think Ayende lowered it after some complaints (http://groups.google.com/group/ravendb/browse_thread/thread/4dedb5d30a992170 - Ayende's first message says 799$, and today it's 599$).
haarrrgh
+1  A: 

You can use the famous cassandra DB. It also uses the thrift interface.

+6  A: 

RavenDB from Ayende is a .NET based backend and client NOSQL (specifically document database). The source is freely available. The performance is on par with MongoDB (last tests were around the 6000 inserts per second). Indexing is done in a very clever way using LINQ. Rest interface, Web UI. Very very smart in fact.

RavenDB can run as a Service, in IIS or via a console (exe). REquires .NET 4 for server-side

Client can be .NET 3.5, in fact client will run in Mono I believe.

http://groups.google.com/group/ravendb/web - all the documentation there is

Edit : Went to launch event, amazing features added and lots more to come. Everyone was blown away by Raven so def one to check out.

Barry King
but it costs a small fortune to use!!
Keith Nicholas
In comparison to RDBMS no. In comparison to FREE NOSQL systems, yes - $25 per month per instance. FREE instance for Startups, totally FREE for Open Source Projects and Ayende is flexible on Charities, Non-profit etc. Just ask.
Barry King
Correct me if I am wrong but RavenDB uses Lucene.NET for it's document storage right?
Kane
No, documents are stored in ESENT (file storage) but they are indexed via lucene. When you query documents, update, create them etc, the index is updated but the document is not stored in lucene. Does that makes sense?
Barry King
+2  A: 

Another option is MemcacheDB.

It's based around Memcache, but adds persistent storage. Here's their blurb:

MemcacheDB is a distributed key-value storage system designed for persistent. It is NOT a cache solution, but a persistent storage engine for fast and reliable key-value based object storage and retrieval. It conforms to memcache protocol (not completed, see below), so any memcached client can have connectivity with it. MemcacheDB uses Berkeley DB as a storing backend, so lots of features including transaction and replication are supported.

Russ C
A: 

If you want light database engines that work well with .NET and with LINQ support, you can try Eloquera, STSdb, and Siaqodb.
See this post on my blog to get a feel for what they offer.

Fabrice
@Fabrice SO is your blog? :)
bzlm
Oops. Thanks for the heads up!
Fabrice