System.InvalidOperationException: No mapping to a relational type can be found for property with the CLR type 'Guid' mysql
Posted by: Anthony Gatlin
Date: May 07, 2017 10:51AM

I am having difficulty when trying to use a Guid as a primary key on an entity in Entity Framework Core 1.0 using the latest MySQL Connector and EF Core MySQL provider.

public class Person
{
[Key]
public Guid PersonId { get; set; }

[Required]
[MaxLength(25)]
public string FirstName { get; set; }

[Required]
[MaxLength(25)]
public string LastName { get; set; }
}

When I attempt to create the database using EF Migrations, I get the following error.

Applying migration '20170507161040_InitialCreate'.
System.InvalidOperationException: No mapping to a relational type can be found for property 'ClassLib.Person.PersonId' with the CLR type 'Guid'.

Someone else had already reported this issue back in January, and the person was told that the functionality had not yet been implemented but was in progress.

https://forums.mysql.com/read.php?38,653992,653992

Guid-based primary keys are extremely common (and arguably necessary) in many projects.

Is there any idea when Guids may be supported?

Options: ReplyQuote


Subject
Written By
Posted
System.InvalidOperationException: No mapping to a relational type can be found for property with the CLR type 'Guid' mysql
May 07, 2017 10:51AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.