简体   繁体   English

asp.net Identity 2.0可以在自己的项目中运行吗?

[英]Can asp.net identity 2.0 run in it's own project?

I have just created a new asp.net mvc 5 project, but would like to abstract all of the identity logic into it's own project. 我刚刚创建了一个新的asp.net mvc 5项目,但想将所有身份逻辑抽象到它自己的项目中。 I did something like this with asp.net identity 1.0, but through lack of understanding or otherwise, found it less than ideal as it appeared that I needed to duplicate several references for each project as well as the entity framework connection string to get it to work. 我使用asp.net identity 1.0做了类似的事情,但是由于缺乏理解或其他原因,发现它不太理想,因为我似乎需要为每个项目以及实体框架连接字符串复制多个引用以获取它。工作。 I tried this same tactic with the latest version of identity 2.0 with no success. 我使用最新版本的Identity 2.0尝试了相同的策略,但没有成功。 So is there a suggested way to do this, or is it better to just keep all the identity logic in the main mvc startup project? 因此,有没有建议的方法来做到这一点,还是将所有身份逻辑保留在主mvc启动项目中更好?

There should be nothing preventing you from writing a shared class library that abstracts identity apis for you. 应该没有什么可以阻止您编写为您抽象身份api的共享类库。 Your MVC app would depend on the shared class library and use any apis exposed there, while your class library can reference identity (or whatever else you want) to implement its functionality. 您的MVC应用将依赖于共享类库,并使用在那里公开的任何api,而您的类库可以引用身份(或您想要的任何其他名称)来实现其功能。

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

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