Decoupling Microsoft.AspNet.Identity.*

asp.net-identity asp.net-mvc asp.net-mvc-5 entity-framework owin

Popular Answer

You may get an updated version of my sample project here: RC1 identity sample

As I didn't want to reimplement all the Store classes, it now implements an entity framework model but still requires a reference to the Microsoft.AspNet.Identity.EntityFramework. However, the example demonstrates how to utilize your own POCO classes for the model.

If you wish to get rid of your reliance on Microsoft.AspNet entirely. You must create a class that implements the IIdentityStore interface and contains the following properties in your model assembly's Identity.EntityFramework:

  • IUserLoginStore
  • IRoleStore
  • IUserSecretStore
  • ITokenStore
  • IUserClaimStore
  • IUserManagementStore
  • IUserStore

IIdentityStore should be a class in a different assembly from your model assembly that also contains a reference to it. The ASP.Net Identity core would be necessary for the IIdentityStore assembly to function.

You would need to find a way for your unique implementation of IIdentityStore to be able to convert between your POCO classes and ASP.Net Identity interfaces like IUser, IUserSecret, etc.

If you already use EF for your stores, it seems like a lot of work for not much reward.

relying on AspNet in some way. Identity. It seems much simpler to me to use core assembly and have some of your POCO classes implement one little interface each.

4
9/12/2013 5:46:45 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow