将现有的Microsoft.AspNet.Identity DB(EF 6)迁移到Microsoft.AspNetCore.Identity(EF Core) [英] Migrate existing Microsoft.AspNet.Identity DB (EF 6) to Microsoft.AspNetCore.Identity (EF Core)

查看:51
本文介绍了将现有的Microsoft.AspNet.Identity DB(EF 6)迁移到Microsoft.AspNetCore.Identity(EF Core)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 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.

  1. 创建一个新的ASP.net Core项目并修改其 ModelSnapshot 以与EF6匹配.之后,您可以生成一个脚本,用于将EF6更改为EF Core.

  1. 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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆