我有一个实现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 Serializer 实现Serialize和Deserialize方法?
答案 0 :(得分:0)
您不必实施IBsonSerializer。 MongoDB映射器可以序列化您的对象。请查看http://www.mongodb.org/display/DOCS/CSharp+Driver+Serialization+Tutorial以获取更多信息和样本。