1.MySQL中需要存储36位GUID,EFCore字段映射位GUID类型,EFCore添加的时候报错:Incorrect string value
2.第一种解决方式:设置GUID字符集
public class BizReviewEntityConfigurations : IEntityTypeConfiguration<Biz_Review>
{
public void Configure(EntityTypeBuilder<Biz_Review> entity)
{
entity.Property(e => e.Guid)
.HasComment("全球唯一关键字").
HasCharSet("utf8mb4").
HasColumnType("CHAR(36)");
}
}
![](/i/l/?n=22&i=blog/1916404/202208/1916404-20220813140019793-495777563.png)
3.第二种解决方式:GUID设置为string类型
![](/i/l/?n=22&i=blog/1916404/202208/1916404-20220813140220670-323808402.png)
标签:Incorrect,string,1916404,value,EFCore,MySQL,GUID
From: https://www.cnblogs.com/pengboke/p/16582924.html