简体   繁体   English

ASP.NET MVC5身份定制

[英]ASP.NET MVC5 Identity Customizing

is there a way to customize the database access in the new MVC5 identity? 有没有办法在新的MVC5身份中自定义数据库访问?

I don´t use the DbContext in my web project, because I created some security and validation layers for database access. 我不在我的web项目中使用DbContext,因为我为数据库访问创建了一些安全性和验证层。

Do I have to derive from UserManager or UserStore, implement the interfaces IUserPassword store or something like that? 我是否必须从UserManager或UserStore派生,实现接口IUserPassword商店或类似的东西?

I heard something about an API to customize identity, but how can I use this API? 我听说过有关自定义身份的API,但我该如何使用此API?

You need to implement your own UserStore and User types to match the schema that you want. 您需要实现自己的UserStore和User类型以匹配所需的架构。 You will have to implement the Interfaces for the features that you want in your system You can reuse the UserManager since UserManager just uses the UserStore and User that you pass in. 您必须在系统中实现所需功能的接口您可以重复使用UserManager,因为UserManager只使用您传入的UserStore和User。

The following article explains you in detail how to do it http://www.asp.net/identity/overview/extensibility/overview-of-custom-storage-providers-for-aspnet-identity 以下文章详细解释了如何操作http://www.asp.net/identity/overview/extensibility/overview-of-custom-storage-providers-for-aspnet-identity

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM