NoRM - MongoDB的.NET程序库
Apache
跨平台
C#
软件简介
NoRM是个包装了MongoDB的.NET程序库,简化了.NET操纵该文档数据库的过程。其主要特性有:强类型的接口、支持LINQ、支持.NET与Mono。
该提供器的主要特性有:
-
为MongoDB提供了一个强类型的接口
-
支持大多数常用的MongoDB命令
-
支持LINQ-to-MongoDB
-
兼容于.NET与Mono
-
BSON到.NET CLR类型的双向序列化;BSON是MongoDB所用的JSON文档的二进制编码序列化格式
下面是NoRM的使用示例:
//connString is a URI to the database with the credentials you need.
var coll = (new Mongo(connString)).GetCollection();
//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();