为什么IdentityUser类在Microsoft.AspNet.Identity.EntityFramework命名空间中而不在Core程序包中? [英] Why is the IdentityUser class in the Microsoft.AspNet.Identity.EntityFramework namespace and not in the Core package?

查看:51
本文介绍了为什么IdentityUser类在Microsoft.AspNet.Identity.EntityFramework命名空间中而不在Core程序包中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么Microsoft.AspNet.Identity.EntityFramework包中的IdentityUser类而不是包含在Microsoft.AspNet.Identity.Core包中?

Why is the IdentityUser class in the Microsoft.AspNet.Identity.EntityFramework package instead of being included in the Microsoft.AspNet.Identity.Core package?

为什么要依赖EntityFramework?这似乎是一个简单的类.

Why should it depend on EntityFramework? It seems to be a simple class.

我想念什么?

我通常按数据层与DAL分开.将IdentityUser类的依赖项添加到EntityFramework似乎有点.

I typically separate by Data layer from my DAL. Adding a dependency to EntityFramework for the IdentityUser class seems a bit much.

推荐答案

身份核心的设计未与EF或任何特定形状的用户和角色类型耦合.一切都被商店抽象化了.实际上,对于任何给定的持久性提供程序,这些类型甚至都不需要是POCO!

The design of the core of Identity is not coupled to EF or to any specific shape of user and role types. Everything is abstracted by the stores. In fact, for any given persistence provider, the types don't even need to be POCOs at all!

对于Identity 3.0,我们考虑将当前的类型包含在核心中(实际上,在某些时候我们已经将它们存在),但是熟悉其他持久性框架的人也得到了相当可观的反馈,尽管这些类型可以遵循以下通用定义: "POCO",它们非常适合EF.

For Identity 3.0 we considered having our current types in core (in fact, at some point we had them there) but we got pretty solid feedback from people familiar with other persistence frameworks that although those types can comply to a common definition of "POCO", they are very EF specific.

我们还考虑了在EF软件包中为EF扩展的核心基类.我们降落到了现在的位置,因为这样做似乎没有带来足够的好处.介于增加额外的继承层的复杂度(更多的复杂度将使我们更容易引入错误)与类型本身并不那么复杂以及持久性提供程序作者希望将它们视为一个继承之间的事实之间.欢迎起点复制粘贴代码.

We also considered having base classes in core that we would extend for EF in the EF package. We landed where we are because there didn't seem to be enough benefit in this. It was between adding the complexity of an extra layer of inheritance (more complexity would make it easier for us to introduce bugs) vs. the fact that the types themselves aren't that complex and that persistence provider writers who want to take them as a starting point are welcome to copy & paste the code.

这篇关于为什么IdentityUser类在Microsoft.AspNet.Identity.EntityFramework命名空间中而不在Core程序包中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆