I am trying to register new DbTypes for custom user types, and it is only allowing me to use the asp.net DbTypes to associate custom user types that I have created.. for instance:
/// <summary>
/// An SQL dialect for PostgreSQL 8.2 and above.
/// </summary>
/// <remarks>
/// PostgreSQL 8.2 supports <c>DROP TABLE IF EXISTS tablename</c>
/// and <c>DROP SEQUENCE IF EXISTS sequencename</c> syntax.
/// See <see cref="PostgreSQLDialect" /> for more information.
/// </remarks>
public class PostgreSQL82Dialect : PostgreSQL81Dialect
{
public PostgreSQL82Dialect()
{
RegisterColumnType(DbType.Guid, "uuid");
RegisterColumnType(DbType.Object, "uuid[]");
RegisterColumnType(DbType.Object, "integer[]");
RegisterColumnType(DbType.Binary, "jsonb");
}
public override bool SupportsIfExistsBeforeTableName
{
get { return true; }
}
public override string GetDropSequenceString(string sequenceName)
{
return string.Concat("drop sequence if exists ", sequenceName);
}
}
I added uuid[], integer[] and jsonb. The only problem is when you try to do a schema update it always gets the last column type registered for any given dbtype. The problem with that is, there is no .net data type specified for arrays or blobs... so I have to use object for them. In this case, any custom user type that has a dbtype of object will always be an integer array in the database when I call schema update like so:
var update = new SchemaUpdate(configuration);
update.Execute(true, true);
Is there another way to let NHibernate know how to map these columns to the database?
Thanks in advance.