PetaPoco
PetaPoco copied to clipboard
Default mappers should ignore read-only or unsupported property
Read-only properties should be ignored or handled only in INSERT/UPDATE. But INSERT/UPDATE handling is not supported at all.
Mappers should also check if property type can be handled, eg. implements IConvertible interface, is primitive or value type.
ConventionMapper can contain this code:
MapColumn = (ci, t, pi) =>
{
// Check if property is supported
if ((!pi.PropertyType.IsValueType && !typeof(IConvertible).IsAssignableFrom(pi.PropertyType)) || !pi.CanWrite)
return false;
// ... rest of code
};
Currently read-only property which is not explicitly marked as ignored throw missing column exception or null reference exception if column exists in database.
Hi, I am trying to accomplish my first contribution to PetaPoco.
what if we implement the behavior you described in the ColumnInfo class it self?