public void Serialize(
BsonWriter bsonWriter,
Type nominalType,
object value,
IBsonSerializationOptions options)
{
if (value == null)
{
bsonWriter.WriteNull();
}
else
{
var actualType = value.GetType();
if (actualType != typeof(object))
{
var message = string.Format("ObjectSerializer can only be used with type System.Object, not type {0}.", actualType.FullName);
throw new InvalidOperationException(message);
}
bsonWriter.WriteStartDocument();
bsonWriter.WriteEndDocument();
}
}
}