You need to use the MaxLength attribute.
[MaxLength(16)]
public byte[] test { get; set; }
, tinyblob, / . :
AddColumn("dbo.testDB", "test", c => c.Binary(storeType: "tinyblob"));
column TypeName "Binary", / .
[MaxLength(16), Column(TypeName = "Binary")]
public byte[] test { get; set; }
, (1) ( ).
: , (16) binary :
AddColumn("dbo.testDB", "test", c => c.Binary(storeType: "binary(16)"));
, , Column .
Edit2: , MySqlMigrationSqlGenerator.
internal class CustomMySqlMigrationSqlGenerator : MySqlMigrationSqlGenerator
{
protected override MigrationStatement Generate(CreateTableOperation op)
{
MigrationStatement statement = base.Generate(op);
foreach (ColumnModel column in op.Columns)
{
if (column.MaxLength.HasValue)
{
statement.Sql = statement.Sql.Replace($"`{column.Name}` binary", $"`{column.Name}` binary({column.MaxLength.Value})");
}
}
return statement;
}
}