簡體   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