问题描述
我正在使用 Microsoft.AspNet.Identity 的应用程序(APS.net MVC).现在,我想将我的应用程序升级到使用 Microsoft.AspNetCore.Identity 的APS.net Core.但是,这两个模型在每个模型中都有一些差异.是否有任何直接方法可以为 Microsoft.AspNetCore.Identit y相关更改生成初始迁移,以将现有数据库与Asp.net Core身份进行连接?
I am working on an application (APS.net MVC) which uses Microsoft.AspNet.Identity. Now I want to revamp my application to APS.net Core which uses Microsoft.AspNetCore.Identity. But those two has some differences in each model. Is there any direct way to generate initial migration for Microsoft.AspNetCore.Identity related changes in-order to connect existing DB with Asp.net Core identity?
推荐答案
我能够使用以下步骤迁移现有数据库.
I was able to migrate existing DBs using the following steps.
-
创建一个新的ASP.net Core项目并修改其
ModelSnapshot
以与EF6匹配.之后,您可以生成一个脚本,用于将EF6更改为EF Core.
Create a new ASP.net Core project and modify it's
ModelSnapshot
to match with EF6. After that, you can generate a script for the changes of EF6 to EF Core.
编写脚本以更新AspNetUsers表.在ASP.net核心身份验证时,使用 NormalizedEmail
, NormalizedUserName
列.因此,我们需要使用现有数据更新这两列.
Write a script to update the AspNetUsers table. In ASP.net core identity when authenticating it is used NormalizedEmail
, NormalizedUserName
columns. So we need to update those two columns using our existing data.
希望这可以帮助某个人...
Hope this helps someone out there...
请继续此 GitHub主题以获取更多信息.
Please follow up this GitHub thread for more information.
这篇关于将现有的Microsoft.AspNet.Identity DB(EF 6)迁移到Microsoft.AspNetCore.Identity(EF Core)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!