MySQL EF Core all string fields are create as text columns

asp.net-core entity-framework entity-framework-core mysql

Question

When generating my Tables using Entity Framework Core for MySQL all of the string properties are being created as text columns in MySQL

I am using:

<PackageReference Include="MySql.Data" Version="8.0.8-*" />
<PackageReference Include="MySql.Data.EntityFrameworkCore" Version="8.0.8-*" />

I am trying to use the built in Identity authentication in .net and when I generate the tables I get the error:

BLOB/TEXT column 'NormalizedEmail' used in key specification without a key length

I can work around this by adding:

builder.Entity<IdentityRole>().Property(i => i.NormalizedName)
                                  .HasColumnType("varchar(256)");

But I don't want to do this for every column in the Identity Model nor do I really want columns I add like FirstName being stored as a text column.

Is this a bug in EF Core for MySQL or do I have some configuration wrong?

1
1
8/11/2017 5:47:19 AM

Accepted Answer

Thanks to @Tseng for the recommendation of using Pomelo. It was a simple switch and it solved all of my problems.

0
8/17/2017 9:32:19 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow