C# Asp.Net MVC Core Identity - 迁移忽略 ASPNETUsers 表中的新列

问题描述 投票:0回答:1

我有一个新的 SQL Server 数据库,其中没有表,托管在 Azure 中。

我有一个 ApplicationUser 实体,它继承自 IdentityUser:

[![在此处输入图像描述][1]][1]

我正在 Visual Studio 的终端中运行以下命令:

dotnet ef migrations add "CreateProdAuthDatabase"
dotnet ef database update

迁移成功,但是当我查看快照文件时,ApplicationUser 中的新列不在快照中,已被忽略。

...因此,当我尝试使用新数据为数据库播种时,我收到以下 SQLException:

[![在此处输入图像描述][2]][2]

...我不明白发生了什么,以及为什么在运行迁移时新的实体字段被忽略?

有什么想法吗? [1]:https://i.stack.imgur.com/XYTVO.png [2]:https://i.stack.imgur.com/9QvGN.png

asp.net-mvc asp.net-core asp.net-identity entity-framework-migrations
1个回答
0
投票

解决了这个问题,我忘记用新字段更新 IdentitySchema 文件。

我现在有一个新错误,为此我发布了一个单独的问题...

© www.soinside.com 2019 - 2024. All rights reserved.