专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > 其他数据库

mongoDB 官方C#驱动 序列化数组但序列成System.Collections.Generic.List`1解决方法

发布时间:2010-05-24 21:31:18 文章来源:www.iduyao.cn 采编人员:星星草
mongoDB 官方C#驱动 序列化数组但序列成System.Collections.Generic.List`1
使用官方C# Driver
C# code

   [Serializable]
    public class ActionClass
    {
        [BsonId(IdGenerator = typeof(StringObjectIdGenerator))]
        public string ID { get; set; }
        public string Content { get; set; }

        public string[] Tag { get; set; }
     }


Inser方式为:
C# code

        public static string Insert(ActionClass row)
        {
            SafeModeResult rtn = DB.GetCollection(TableName).Insert<ActionClass>(row);
            return row.ID;
        }


以后变成:
  _id : 4edb82e2089a001064402fb2 
  Content : 现在才v 
  Tag : System.Collections.Generic.List`1[System.String] 
这里应该是["A","B","C"]才对的,但为什么序列化成类型了呢?请各位大侠指教

------解决方案--------------------
System.Collections.Generic.List`1[System.String]这只是个显示。你到数据库里查询看看db.xxx.find()
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: