locked
Converting SQL Membership Provider to Identity 2.0 RRS feed

  • Question

  • User1168913849 posted

    I'm trying to convert my old application with SQL Membership to .NET Identity 2.0

    I've found this page but this doesn't apply to Identity 2.0 since the database structure has been changed from Identity 1.0

    http://www.asp.net/identity/overview/migrations/migrating-an-existing-website-from-sql-membership-to-aspnet-identity

    There are so many features that are missing from SQL Membership and wondering how everyone is dealing with this.

    My biggest problem is that Identity framework doesn't have ApplicationID which my old application uses custom membership provider.

    There are not many documents about Identity framework and not sure what to do with my customer membership providers...

    Also, Is Identity will obsolete and end up like Simple membership or Universal providers?

    Any suggestions will be helpful.

    Thank you

    Tuesday, April 29, 2014 4:34 PM

All replies

  • User-734925760 posted

    Hi,

    According to your description and the artical you provided, I think there is no much difference between converting to Identity 2.0 and Identity 1.0.

    I think you can try to convert by the steps of converting to Identity 1.0.  But in the artical we can get that we need to create model classes which map back to the tables and hook them up in the Identity system. As part of the Identity contract, the model classes should either implement the interfaces defined in the Identity.Core dll or can extend the existing implementation of these interfaces available in Microsoft.AspNet.Identity.EntityFramework. So if you want to convert to Identity 2.0, we must create some tables.

    There is an artical about how to convert Identity 1.0 to Identity 2.0, please refer to the link below:

    http://blogs.msdn.com/b/webdev/archive/2013/12/20/updating-asp-net-applications-from-asp-net-identity-1-0-to-2-0-0-alpha1.aspx

    Hope it's useful for you.

    Best Regards,

    Michelle Ge

    Wednesday, April 30, 2014 4:34 AM
  • User1168913849 posted

    Thank you for your reply!

    I've read Identity upgrade tutorial, but this will break the original conversion tutorial.

    The tutorial uses custom class "User" which uses value in Discriminator column in AspNetUsers Table.

    It said "Createa Models folder in the project and add a class User. The name of the class should match the data added in the 'Discriminator' column of 'AspnetUsers' table."

    Identity 2.0 eliminated the column from the database.

    I know that you can always add your own but I feel that there are so many custom columns you have to add in order to make it functional as SQL membership.

    My concern is that if I add custom columns in Identity Membership table, database gets messy in the future updates.

    For example, Identity 1.0 didn't have email address columns. 

    Luckly, the tutorial uses same column name and data type.

    What if Email data was in different table or different data type?



    Anyways, my main question is that how should I handle custom columns that are missing from SQL membership?

    For now, I'm trying to separate them from Identity tables.



    I also see that Identitie's UserID doesn't use data type "uniqueidentifier" anymore.

    Instead it uses nvarchar(128).

    In the tutorial, it's importing SQL membership user ID, but how doesn't it conflict with Identity User ID?



    My goal is to build a login system that I can use in the future.

    I hope Identiy framework won't become like Simple membership...



    Thank you

    * My questions are in bold.

    Wednesday, April 30, 2014 12:29 PM
  • User-209957327 posted

    hey, just wondering if you found a solution to the UserID guid => varchar problem?

    Tuesday, September 2, 2014 8:07 PM
  • User1168913849 posted

    I haven't found a good migration path yet.

    I decided to let it ferment a little bit until newer version of Identity comes out.

    There are too many missing feature from SQL membership provider and I can't use it as is. 

    Wednesday, September 3, 2014 7:39 PM
  • User1168913849 posted

    https://www.youtube.com/watch?v=JbSqi3Amatw

    I haven't tried but this may help.

    Wednesday, September 3, 2014 9:04 PM