public object DeserializeBsonValue(TypeConfiguration typeConfig, IEntityHandler parent, string property, BsonDeserializingContext context) { if (typeConfig.Creator != null) { var result = typeConfig.Creator(parent, property); var handler = (IEntityHandlerProvider)result; handler.GetHandler().DeserializeBson(context); return(result); } else { return(BsonSerializer.Deserialize(context.BsonReader, typeConfig.Type)); } }
public object DeserializeMemeberValue(TypeConfiguration typeConfig, IEntityHandler parent, string property, DeserializingContext context) { if (typeConfig.IsExternalType) { return(context.Serializer.Deserialize(context.Reader, typeConfig.Type)); } else if (typeConfig.Creator != null) { var result = typeConfig.Creator(parent, property); var handler = (IEntityHandlerProvider)result; handler.GetHandler().Deserialize(context); return(result); } else { throw new Exception(); } }