Link Search Menu Expand Document

Db2ByteToInt16PropertyHandler


Db2 has no native single-byte integer type — the smallest Db2 integer type is SMALLINT (a 16-bit signed integer), which IBM.Data.Db2 surfaces to .NET as short. A byte entity property therefore cannot be bound directly against a SMALLINT column.

This IPropertyHandler converts a byte entity property to/from a short for binding against such a column.

Like Db2GuidToByteArrayPropertyHandler, it is intentionally not registered automatically for every byte property — register it explicitly, scoped to the specific entity property that maps to a SMALLINT column.

Usability

PropertyHandlerMapper.Add<CompleteTable, byte>(
    e => e.ColumnByte, new Db2ByteToInt16PropertyHandler(), true);