ASP.NET Identity Producer
CodeFluent Entities can generate out of the box Membership, Role & Profiles Providers. Recently Microsoft release a new Identity system: ASP.NET Identity. As it seems to be more and more use, we decided to write a new producer to support this new Identity system.
First of all, the source code of the producer is available on our GitHub repository.
The producer does two things:
- It assists you in creating ASP.NET Identity entities (User, Role, Claim, Login)
- It generates the UserStore and RoleStore and implements IUser and IRole
How to install
- Download the code from GitHub and compile it. A compiled version is also available here
- Copy the output “CodeFluent.Producers.AspNetIdentity.dll” to “C:\Program Files (x86)\SoftFluent\CodeFluent\Modeler”
- (Optional) To integrate the producer to the graphical modeler copy or merge “custom.config” to “%APPDATA%\CodeFluent.Modeler.Design\custom.config”
How to use it
- Create a CodeFluent Entities project
- Add a Business Object Model (BOM) producer
- Add this new producer (Security -> Asp.Net Identity). Note: The target path has no effect. The target path will be “Target Path of the BOM Producer\Web\Security(User|Role)Store”
- Right click on the producer and click the “Create Identity Entities” menu item
- Select necessary entities (User, Role, Claim, Login) and the destination namespace
- Customize entities. For example you can remove “Password” property if you don’t need it
- Generate and use the code 🙂
Note: you must add the “Microsoft.AspNet.Identity.Core” Nuget package before compiling the generated code (but this is obvious).
CodeFluent Entities is very extensible. As we try to show in this article, one way of extending it is by using producers. Of course the main goal of producers is to generate code. But they can also interact with the model at design time thanks to the CodeFluent Entities API.
Please share your feedbacks about this producer and don’t hesitate to make some suggestion.
The R&D Team.