Upgrading from ASP.NET.Identity 1.0 to 2.0
ASP.NET.Identity 2.0 is out, and it adds a bunch of great features.
– Two-Factor Authentication (SMS, Email or custom)
– Account Lockout
– Account Confirmation via Email
– Password Reset
– Sign out everywhere
– Choose your Primary Key type (string, int, Guid)
– IQuerable Users and Roles
– Delete User
– Enforcing Unique User Names
The upgrade was more fiddly than I thought it would be. Here is what I had to do. I hope it helps.
1. Update Entity Framework to 6.1
2: Update all your OWIN components if they already exist in your project.
(Yes. NuGet should handle this for me. It didn’t. Upgrading the Owin components before the Identity packages resolved some issues for me)
3: Update Microsoft ASP.Net Identity Core and then ASP.Net Identity EntityFramework
4: Your model has now been updated to v2.0 !
If you are running Code First Migrations you now need to create a migration to reflect the changes to the database.
Figure: When you try to create the migration, it will tell you that the model backing the db context has changed. To resolve it, you need to update the constructor of your dbcontext.
Figure: Adding ‘, throwIfV1Schema:false’ as a parameter to the constructor will allow you to run the application, and create the required Code First Migration.
Figure: After updating the db context constructor, Add-Migration works as expected.
Figure: You can now inspect the changes to the schema in the Migration.
Upgraded !
Now check out the links below to get help on how to implement the great new features in ASP.Net Identity 2.0.
Resources:
ASP.NET MVC and Identity 2.0: Understanding the Basics
– a great overview of Identity 2.0
Announcing RTM of ASP.NET Identity 2.0.0
http://blogs.msdn.com/b/webdev/archive/2014/03/20/test-announcing-rtm-of-asp-net-identity-2-0-0.aspx
– definitely worth reading !
– contains list of features and some upgrade notes
Hi, this was really useful! But I have a problem – instead of RenameColumn, AddColumn or some other command I have only CreateTable commands in my Up method and DropTable and DropIndex in my Down method. This leads to a conflict, because it tries to create a table before it had deleted it. Any ideas how to fix this? Thank you in advance! 🙂
あなた本当にプレゼンテーションしかし | | 本当に簡単そう簡単それは見えるようです作るI 見つけるこのトピック 私は希望私は信じ 何か 私がかもしれない 決して理解しています。 複雑な複雑と 非常に ワイド私のために。公開| |提出| 先に前進 外観を持つ 、それをぶら下げる|しがみつく|把握|ホールド|} 私は {しようとするでしょう!
最安値定番 完売これで最後 http://saunadveri.ru