我如何使用wcf序列化器序列化mongodb c#驱动程序中的对象
本文关键字:序列化 驱动程序 对象 何使用 wcf mongodb | 更新日期: 2023-09-27 18:17:41
我有一个实现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实现序列化和反序列化方法?
您不必实现IBsonSerializer。MongoDB映射器可以序列化你的对象。查看http://www.mongodb.org/display/DOCS/CSharp+Driver+Serialization+Tutorial获取更多信息和示例。