IdentityServer4使用EFCore生成MySql时的小bug

Posted 龙码精神~~

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了IdentityServer4使用EFCore生成MySql时的小bug相关的知识,希望对你有一定的参考价值。

EFCore生成PersistedGrantDbContextModelSnapshot的时候发现

 b.Property<string>("Data")
                        .IsRequired()
                        .HasMaxLength(50000);

最大长度是50000然而在

InitialIdentityServerPersistedGrantDbMigration中

 Data = table.Column<string>(maxLength: 50000, nullable: false)

这样会导致IdentityServer4中的 persistedgrants 表生成失败 如: 提示错误是超过了最大长度限制20543 

然而就算把长度改成2000还是会失败

需要重新设置下字段类型 为 text

 Data = table.Column<string>("text",maxLength: 50000, nullable: false),

 

以上是关于IdentityServer4使用EFCore生成MySql时的小bug的主要内容,如果未能解决你的问题,请参考以下文章