PgShortArray Converter and Attribute missing

Found out today that we previously missed the PostgreSQL Short Array converters and attributes.

Note: Using [PgSqlIntArray] attribute seems to work as a work around for now, but doesn’t automatically pick up short[] typed props and need to use the attribute. This is with PostgreSQL v11 so unsure if that wouldn’t work on older versions of PostgreSQL.

The following seemed to work.

// https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/src/ServiceStack.OrmLite.PostgreSQL/Converters/PostgreSqlArrayConverters.cs

public class PostgreSqlShortArrayConverter : PostgreSqlArrayConverterBase<short>
{
    public override string ColumnDefinition => "short[]";
}

// https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Interfaces/DataAnnotations/CustomFieldAttribute.cs

public class PgSqlShortArrayAttribute : CustomFieldAttribute
{
    public PgSqlShortArrayAttribute() : base("short[]") { }
}

And add RegisterConverter<>
// https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/src/ServiceStack.OrmLite.PostgreSQL/PostgreSQLDialectProvider.cs

// Line 63
RegisterConverter<short[]>(new PostgreSqlShortArrayConverter());

Also, thought we somehow missed arrays for timestamp[] and timestamptz[] but noticed that the Attribute doesn’t have “Array” in the name. Not sure if that is a concern.

Line 62 PgSqlTimestampAttribute and Line 67 PgSqlTimestampTzAttribute

This support for short[] as well as new PgSqlTimestampArrayAttribute and PgSqlTimestampTzArrayAttribute attributes are now available on MyGet.

@mythz looks the following needs to be added to the Dictionary<> NativeTypes

{ "short[]", NpgsqlDbType.Array | NpgsqlDbType.Short },

NpgsqlDbType.Short does not exist, looks like npgsql uses NpgsqlDbType.Smallint instead.

Oops… Transposed PostgreSQL with C#. Good catch mythz!