BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News NoRM: Another .NET Provider for MongoDB

NoRM: Another .NET Provider for MongoDB

This item in japanese

Bookmarks

NoRM is a .NET library acting as a wrapper around MongoDB, facilitating .NET programming against the mentioned document database. Some of the features are: strongly-typed interface, supporting LINQ, supporting both .NET and Mono.

The main features of the provider are:

  • Providing a strongly-typed interface to MongoDB
  • Supporting most common MongoDB commands
  • Supporting LINQ-to-MongoDB
  • Compatible with .NET and Mono
  • BSON to .NET CLR types back and forth serialization; BSON is the binary-encoded serialization of JSON documents that MongoDB is using

An example of using NoRM (taken from the wiki):

//connString is a URI to the database with the credentials you need.
var coll = (new Mongo(connString)).GetCollection<Product>();
//create a new object to be added to the collection
var obj = new Product();
obj._id = ObjectId.NewObjectID();
obj.Title = "Shoes";
//save the object
coll.Insert(obj);
//find the object
var obj2 = coll.FindOne(new { _id = obj._id}).First();

Another .NET provider for MongoDB is MongoDB-CSharp. According to its author, Steve Wagner, MongoDB-CSharp has been tested on .NET/Windows and Mono 2.0/Ubuntu.

Raven DB, another document database specifically targeting .NET, has been covered by InfoQ when it was released. Unlike MongoDB which is licensed under GNU AGPL v3.0, Raven DB has a free license for open source projects and a paid license for commercial projects.

Rate this Article

Adoption
Style

BT