Bug #65289 | Cannot create an entity with a key of type string | ||
---|---|---|---|
Submitted: | 11 May 2012 21:05 | Modified: | 28 Sep 2012 19:02 |
Reporter: | Brice Lambson | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / NET | Severity: | S2 (Serious) |
Version: | 6.5.4.0 | OS: | Windows |
Assigned to: | Gabriela Martinez Sanchez | CPU Architecture: | Any |
Tags: | DDL |
[11 May 2012 21:05]
Brice Lambson
[31 May 2012 12:35]
Asger Schlichtkrull
[MaxLength(254)] seems to work here :)
[31 May 2012 12:46]
Asger Schlichtkrull
I was wrong... no primary key were created.
[31 May 2012 12:59]
Asger Schlichtkrull
using the fluent api and the [MaxLength(255)] seems to be a possible work around if anybody needs it. modelBuilder.Entity<MyEntity>() .Property(p => p.ID) .HasColumnType("varchar");
[2 Jun 2012 15:47]
Gabriela Martinez Sanchez
Thanks for your bug report. A fix is in progress.
[4 Sep 2012 20:15]
Gabriela Martinez Sanchez
A fix for this bug has been pushed in Branches 6.4.x, 6.5.x, 6.6,x to be released for the future versions (6.4.6, 6.5.5, 6.6.3).
[28 Sep 2012 19:02]
John Russell
Added to changelog for 6.4.6, 6.5.5, 6.6.3: Connector/Net did not support creating an entity with a key of type string. During database creation, a MySqlException was thrown saying BLOB/TEXT column 'Name' used in key specification without a key length. The DDL produced by the provider specified a MEDIUMTEXT column for the primary key without specifying a length for the key. This fix is particularly important when working with Entity Framework versions 4.3 and later, since the __MigrationsHitory table (which replaces the EdmMetadata table) uses a string property as its key.