ASP.NET Identity
Asked Answered
M

4

19

I'm currently building a new ASP.NET MVC 5 project which I want to release around September. I need to choose a membership system, but I'm currently quite confused about which direction should I take. The current SimpleMembership works well, but will apparently be incompatible with the upcoming ASP.NET Identity. ASP.NET Identity on the other hand is absolutely new with zero documentation and can change anytime. Finally it seems that string based IDs are used here, which seems like a very unnecessary overhead compared to integer based IDs, which SimpleMembership supports. Is there a good, future proof way I can choose?

Magnetism answered 14/7, 2013 at 3:48 Comment(2)
String formatted guids are used in place of actual guids to allow the persistence mechanism to be swapped out more easily, say if you wanted to use a nosql solution that didn't offer support for guids. The id column is indexed, and though an indexed int column performs better, the difference is negligible for most applications.Maldives
See #19239121 for the reason GUIDs are used.Around
U
10

I would advise against using SimpleMembership as well. You can still use int IDs in your database, you would just need to ToString() the ID when plugging in your database entity, i.e.:

public class MyUser : IUser {
   [Key]
   int UserID { get; set; }

   string IUser.Id { get { return UserId.ToString(); } }
}
Urian answered 15/7, 2013 at 23:6 Comment(0)
C
8

In my opinion if you start your project with asp.net mvc 5 you should use the new membership system since it is well integrated with http://owin.org/ standards.

Centerboard answered 14/7, 2013 at 11:11 Comment(1)
Additionally we are adding more tutorials, and there is plenty of support for it on SO.Around
M
1

I would either use the newest version of identity or build your own Account system completely. ASP.NET Identity now uses a GUID ( NVARCHAR(128) - in the db ) for the ID, however you can still use a int if you want to. I know people still using identity 1.0 with no issues I believe they used int for the Id back then.

Either way an Id shouldnt ever clash whether its a int or a guid. as the above post said you can just Id.ToString();

Whatever route you take I dont think it will make much of a difference.

Midway answered 12/8, 2014 at 10:45 Comment(0)
H
0

I believe ASP.NET is quite good framework and provide almost all required functionality for an applications. It also provide feasibility to choose type of Id column as per your choice. I created basic a wrapper over ASP.NET identity and published a nuget, so that it would be easily use. You can take a look on code at github

Halftimbered answered 9/7, 2017 at 10:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.