When starting up Pomona gets its mapping conventions from ITypeMappingFilter
.
By default the DefaultTypeMappingFilter
is used, which defines a set of sane defaults.
If you want to alter these conventions using TypeMappingFilterBase
as a base class
is recommended, as implementing the whole ITypeMappingFilter
interface would be a lot of work.
For some examples see code below:
public class CrazyConventions : DefaultTypeMappingFilter
{
public CrazyConventions(IEnumerable<Type> sourceTypes)
: base(sourceTypes)
{
}
public override string GetPropertyMappedName(Type type, PropertyInfo propertyInfo)
{
// No cursing in the api
return base.GetPropertyMappedName(type, propertyInfo).Replace("Shit", "Poo");
}
public override IEnumerable<Type> GetResourceHandlers(Type type)
{
// All our handlers follow the same naming convention
return new[] { type.Assembly.GetType($"{type.FullName}Handler") };
}
public override bool PostOfTypeIsAllowed(Type type)
{
// No post of type allowed by default
return false;
}
}
For further information see the ITypeMappingFilter
interface definition. Most of the methods
should hopefully be self-explanatory.