Search code examples
visual-studioef-code-firstasp.net-membershipmembership-provider

SimpleMembership => Have GUID for the UserId


Unlike many post I've seen online, It's not if I prefer Guid or Int.

Question: I'd like to know HOW to make a Guid for the UserId for the SimpleMembership. If I can't, how to do my own provider code first in order to put, in the end, the UserId in another table (to link a record to the user that did it + I don't want the username (what happens if it changes?)).

My research: I've seen that you would have to subclass and reimplement every methods, but nowhere there was a post that explains how to do it. The closest post I've seen is : http://www.brianlegg.com/post/2011/05/09/Implementing-your-own-RoleProvider-and-MembershipProvider-in-MVC-3.aspx but it's still with Int as the Identity Pk.

I understand that it may be a feature for VS2012 to do so, but VS2010 does all the tables (User with Guid has Id and all the other tables with Guid columns). I'd still like my UserId with Guid and not int.

Thanks!


Solution

  • I believe you are looking for SimpleGuidMembershipProvider