繁体   English   中英

如何使用wcf序列化程序在mongodb c#驱动程序中序列化对象?

[英]How can I use wcf serializer for serialize objects within mongodb c# driver?

我有一个实现IBsonSerializer的类:

public class PersistentObject : IBsonSerializer
    {
        public object Id { get; set; }

        public object Deserialize(BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options)
        {
            throw new NotImplementedException();
        }

        public object Deserialize(BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options)
        {
            throw new NotImplementedException();
        }

        public bool GetDocumentId(object document, out object id, out Type idNominalType, out IIdGenerator idGenerator)
        {
            throw new NotImplementedException();
        }

        public void Serialize(BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
        {
            throw new NotImplementedException();
        }

        public void SetDocumentId(object document, object id)
        {
            throw new NotImplementedException();
        }

    }

是否可以使用WCF序列化器实现序列化和反序列化方法?

您不必实现IBsonSerializer。 MongoDB映射器可以序列化您的对象。 有关更多信息和示例, 请访问http://www.mongodb.org/display/DOCS/CSharp+Driver+Serialization+Tutorial

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM