protected IStringSerializer GetMappedSerializer()
{
ISerializerFactory sf = GetService<ISerializerFactory>();
IDataTypeMapper mapper = GetService<IDataTypeMapper>();
if (sf != null &&
mapper != null)
{
object obj = SerializationContext.Peek();
// Get the data type for this object
Type type = mapper.GetPropertyMapping(obj);
if (type != null)
return sf.Build(type, SerializationContext) as IStringSerializer;
else
return new StringSerializer(SerializationContext);
}
return null;
}