In the previous EF, I could do this:
entityTypeBuilder .Property(b => b.Foo) .IsRequired() .HasMaxLength(10) .IsFixedLength();
That would generate a migration with something like
Foo = c.String(nullable: false, maxLength: 10, fixedLength: true)
However in EF Core there is no
Is there some other way of doing this?
Currently (EF Core 1.1.0) you can only specify column type directly:
Please make sure your DB engine understand this value! It is passed "as is".
Also please note that you should write all required dimension/length/precision values here, because
.HasMaxLength() value will be ignored.
Actually, as for Version 2.1 this is implemented as:
entity.Property(e => e.Name).HasMaxLength(X).IsFixedLength();