Identity icon indicating copy to clipboard operation
Identity copied to clipboard

AddIdentity for non-IdentityUser class

Open angelsix opened this issue 11 years ago • 2 comments

My data models live in Core, so that every area of the application can access them. They are all POCO classes.

I want to use the Entity frameworks Identity for ASP.Net, however it appears the class for Entity Framework to do that must base class IdentityUser, which would bind my Core class project to EntityFramework reference just for the class.

I could create a seperate class and cast it to/from the POCO class but that would be very inefficient.

I cannot find any documentation on using the AddIdentity in the first place and only know the EntityFramework one existed as I checked out the UnicornStore demo.

Any notes/guidance on how I can use the Entity Framework Identity when the user is a POCO class not an IdentityUser?

The same applies for the IdentityRole.

Or alternatively any documentation on just creating one myself.

angelsix avatar Sep 28 '15 06:09 angelsix

if you check out the IdentityUser class it should be simple to roll your own.

https://github.com/aspnet/Identity/blob/4e5bba35da259fa79a90426ed02a72f0c03ec861/src/Microsoft.AspNet.Identity.EntityFramework/IdentityUser.cs

dcarr42 avatar Sep 28 '15 12:09 dcarr42

The problem is if I have to create a custom class in my core library, I have to remake all classes (roles, claims, login providers, user stores etc.. basically the entire EntityFramework code in this Identity branch.

I was trying to avoid that but nevermind I will just create my own version.

angelsix avatar Sep 28 '15 14:09 angelsix