Fluent API with ASP.NET Identity

7

As this tutorial , I transported Identity in < in> class library to encapsulate the system business rule. However, the entire system is using the Fluent API to map the entities and Identity generates the tables through the code first .

Is there any contraindication in mapping the IdentityUser class manually? Is it possible to perform this process normally or is there any particularity?

    
asked by anonymous 13.02.2015 / 17:10

2 answers

6
  

Is there any contraindication in mapping the class IdentityUser manually?

It is recommended that you keep the code in Assembly separately as closely as possible to the original template web code. ASP.NET Identity is very responsive to customizations and is quite coupled with the Entity Framework, so in theory using the Fluent API is not a problem as you can get an equivalent result using another approach.

Just make sure nothing is missing while switching approaches.

  

Is it possible to perform this process normally or is there any particularity?

At first, there are no particularities. Just make sure to install this package and this also in the separate Assembly . There all dependencies are resolved for the proper functioning of ASP.NET Identity.

Another care is to not remove the original settings from your Web.config . This is due to the fact that, even referencing the Assembly , the configuration will be based on the web project, not on a .config file placed in Assembly .

    
04.05.2015 / 15:56
4

You can use your own custom classes with Identity.

Just implement the interfaces:

  • IUser
  • IRole
  • IUserStore
  • IUserLoginStore
  • IUserRoleStore
  • IUserClaimStore
  • IUserPasswordStore
  • IUserSecurityStampStore

It gives you a hell of a hassle, but basically you can save your authentication information as you please.

Here we are using MongoDB, for example. Take a look at MongoDB.AspNet.Identity for a complete example of how to customize Identity persistence:

link

    
08.05.2015 / 17:03