你能做到实体继承EF上映射到存储过程的实体?实体、你能、存储过程、射到

2023-09-06 05:38:16 作者:反派作风

我有一个关于继承问题,在实体框架4.我们正在使用的数据库,第一个方法,想调整我们的模型来使用继承。下面是层次结构的白板模拟了我们想在我们的模型中使用。

I have a question about inheritance in Entity Framework 4. We are using a database-first approach and would like to restructure our model to use inheritance. Here is a white board mock up of the hierarchy we would like to use in our model.

在这些情况下,涂鸦不是很可读的,它是这样的。

In case those scribbles are not very readable, it's something like this.

用户LT; - 提供商 用户LT; - 卖方 提供商LT; - 员工

USER <- PROVIDER USER <- VENDOR PROVIDER <- EMPLOYEE

因此​​,用户对供应商和供应商的基类。和员工再从商继承。

So USER is the base class for providers and vendors. And employee then inherits from provider.

我发现描述表一对夫妇的大文章-per-层次继承和表-per型的继承。

I found a couple great articles describing Table-Per-Hierarchy inheritance and Table-Per-Type inheritance.

他们似乎很简单,但两种方法需要一个实体被映射到一个或多个表。如果你有一个完全映射到存储过程的实体?

They seem simple enough but both ways require an entity to be mapped to a table or tables. What if you have an entity that is mapped entirely to stored procedures?

难道还要做到在继承EF即使实体映射到存储过程?如何将看起来?什么样的会,我们必须做到这一点的存储过程?

Is it still possible to do inheritance in EF even if an entity is mapped to stored procedures? How would that look? What kinds of stored procedures would we need to have to accomplish this?

如果有可能,我们真的只需要指出了正确的方向。任何帮助是非常AP preciated。

If it's possible we really just need pointed in the right direction. Any help is much appreciated.

推荐答案

我找啊找,终于到达了,这是不可能做到的继承与映射到存储过程的实体的结论。所以,除非有人能证明,否则,我这标志着作为回答。

I have searched and searched and finally arrived at the conclusion that it is not possible to do inheritance with entities that are mapped to stored procedures. So unless someone can prove otherwise, I'm marking this as the answer.

 
精彩推荐
图片推荐