日期:2014-05-16  浏览次数:21103 次

关于JSON.NET MongoDB Objectid 无法序列化的问题。
public class MyModel
     {

         public Objectid _id ;
         public string title{get;set;}
 }
用这个会提示无法序列化。

 但是
public class MyModel
     {

         [BsonId]
         [BsonRepresentation(BsonType.ObjectId)]
         public string Id { get; set; }
         public string title{get;set;}
 }
的话,是能序列化了,但是查看数据库内的数据会发现 _id 值为null,

 求教有人知道应该怎么办吗?
------解决方案--------------------
不是呀,是建一个ObjectIdConverter