Incorrect specification of VARBINARY(MAX) in MsSql2005Dialect
Description
MsSql2005Dialect.RegisterCharacterTypeMappings contains a type registration for binary with length int.MaxValue. It correctly specifies it to be translated to varbinary(max) in SQL Server 2005 and 2008.
However, after RegisterCharacterTypeMappings, the constructor of MsSql2000Dialect calls RegisterLargeObjectTypeMappings in which the above type is overridden to use the 'image' data type.
Suggested fix (in MsSql2005Dialect):
Remove the line below from RegisterCharacterTypeMappings
MsSql2005Dialect.RegisterCharacterTypeMappings contains a type registration for binary with length int.MaxValue. It correctly specifies it to be translated to varbinary(max) in SQL Server 2005 and 2008.
However, after RegisterCharacterTypeMappings, the constructor of MsSql2000Dialect calls RegisterLargeObjectTypeMappings in which the above type is overridden to use the 'image' data type.
Suggested fix (in MsSql2005Dialect):
Remove the line below from RegisterCharacterTypeMappings
RegisterColumnType(DbType.Binary, SqlClientDriver.MaxSizeForBlob, "VARBINARY(MAX)");
and add
protected override void RegisterLargeObjectTypeMappings()
{
base.RegisterLargeObjectTypeMappings();
RegisterColumnType(DbType.Binary, SqlClientDriver.MaxSizeForBlob, "VARBINARY(MAX)");
}