-
Notifications
You must be signed in to change notification settings - Fork 25.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate Asp.net core initial migration for exisitng DB which was used by Asp.net MVC app #6425
Comments
Please see the guidance provided in the following doc: https://docs.microsoft.com/aspnet/core/migration/proper-to-2x/membership-to-core-identity |
Hi @scottaddie, My current application is having Microsoft.AspNet.Identity (Asp.net MVC). I want to use that DB with Microsoft.AspNetCore.Identity. |
@sampathdr Thank you for the clarification. @blowdart Do you have any resources for migrating Identity tables from ASP.NET 4.x to ASP.NET Core? This detail appears to be missing from our migration guide. |
Nope, not a thing. @HaoK ? |
@ajcvickers are there any general EF 6 -> EF Core migration docs that we can link to here? I don't think we need anything special for the identity migration |
@HaoK Since some properties are different in Microsoft.AspNet.Identity (EF6) and Microsoft.AspNetCore.Identity (EF Core) we cannot directly apply 00000000000000_CreateIdentitySchema migration on top of current DB. So I think we may need to create a migration manually. Is there any better way to handle this? |
Ping. I am also looking for guidance on how to do this. I have several ASP.NET Identity (EF6) databases that I'd like to migrate since we are moving everything to ASP.NET Core. |
@jessebarocio I was able to migrate existing DBs using the following steps.
|
+1 for official guidance on migrating the db as well. |
@sampathdr Any chance you can share the modified ModelSnapshot? |
@nguyenquyhy Yes, I can share ModelSnapshot and generated scripts with you. I will send an email to your email. |
I have an existing Asp.net MVC application with EF6 and an IdentityDbContext. ( Microsoft.AspNet.Identity.EntityFramework.IdentityDbContext ) Is there any way I can use the same database from a .core project that is using EF core. It seems like there is a lack of compatibility that will force me either remain on the full framework or convert all projects (no budget for this) that use the identity db at the same time. |
@sampathdr I'm in the exact same situation. Would you be willing to share your ModelSnapshot and scripts with me as well? |
Hi Jake, I have sent you an email with DB scripts. |
+1 @sampathdr Maybe add as a comment to this thread? |
+1 @sampathdr |
These are the migration scripts I generated. Feel free to modify them accrding to your requirement. |
I was able to update the schema, however I still had to migrate existing users to use the new password hasher algorithm. The easier (probably safer) option is to ask all users to reset their passwords. If you don't want to ask users for resetting their passwords, but want to gradually update password hashes to the new algorithm as they authenticate, I posted what I did in this Stack Overflow question. |
@AlissonRS Hello, Alisson! So if it's not too late and if prior to Identity 3 you've used default hashing strategy, then I'd suggest you to consider try these compatibility features instead of writing them by hand and force users to reset passwords. It worked well in project which I've converted to use new Identity. |
Thanks for your reply. I'm aware of this feature, in fact I tried it, but I think it only works when migrating between .Net Core projects, I tried using this with users created in MVC 5 project and it didn't work. My guess is that this only works for users created using the I appreciate your reply. |
@AlissonRS That's strange. "MVC5 --> Core" conversion was my case (Identity conversion is only a part of it) and users has been created using old packages of Identity. Well, hopefully this might be helpful for anyone else who will face this task :) |
@CallStackRunner I'll give another try just in case, maybe I did something wrong. I'll post the outcome here. |
@CallStackRunner when I use |
@AlissonRS I don't think that default behavior is to update hash, so it's expected that they aren't updated. |
@Rick-Anderson Is there something specific you want me to address here? |
If not, I'll close this issue. |
@Rick-Anderson We currently have this: https://docs.microsoft.com/en-us/ef/efcore-and-ef6/porting/index Plus an issue to make it better: dotnet/EntityFramework.Docs#1180 So closing here. |
I have a existing Asp.net MVC application. In-order to convert it to a Asp.net Core application, how do I generate DB migration. What I need is upgrade ASP.NET identity tables to ASP.NET Core identity.
EDIT: 7.4K PV <-- Serious customers
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: