如果不是呢?
var entity = BsonSerializer.Deserialize<Bar>(bson);
用到的自定义class大概长这样:
public class Bar
{
public ObjectId _id { get; set; }
public string name { get; set; }
public string type { get; set; }
public int number { get; set; }
public int number2 { get; set; }
public BarInfo info { get; set; }
public class BarInfo
{
public int x { get; set; }
public int y { get; set; }
}
}
小感想:
mongodb对程序员是极友好的, 可以动态变化的结构, 让程序员不再害怕频繁变动的需求.
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家对ASPKU的支持。
注:相关教程知识阅读请移步到c#教程频道。










