请支持1)从存储过程返回的多个结果集2)更改Include()以返回多个结果集以消除不必要的复杂查询和冗余数据。 [英] Please support 1) multiple resultsets returned from a stored procedure 2) change Include() to return multiple resultsets to eliminate unnecessary complex query and redundant data.

查看:81
本文介绍了请支持1)从存储过程返回的多个结果集2)更改Include()以返回多个结果集以消除不必要的复杂查询和冗余数据。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在EF4中,不支持从存储过程返回的多个结果集。有3种解决方法:

In EF4, multiple resultsets returned from a stored procedure is not supported. there are 3 ways to workaround:

1。使用Include()方法。该方法将使用单个复杂的连接语句来返回不必要的冗余数据。

1. Use Include() method. the method will use an single complex join statement to return unnecessary redundant data.

2。将存储过程拆分为多个单个语句存储过程(因此在大多数情况下不需要sp),这些将导致对DataSource进行不必要的回合。

2. Split the stored procedure into many single statement stored procedure(so the sp is not need in most case),  these will result unnecessary roundrips to the DataSource.

3。像之前一样使用DbCommand和ObjectContext.Translate()(没有EF),如果是这样,那么EF的好处是什么?

3. Use the DbCommand and ObjectContext.Translate() manully like before(No EF), if so, what is the benefit of EF?

许多旧的复杂应用程序都是bulid 遵循"降低查询复杂性和roundrip到dataServer"微软宣布,为什么EF打破它?应该添加对Founction Import中存储过程返回的多个结果集的支持,  和
更改Include()以返回多个结果集以消除不必要的复杂查询和冗余数据。或者EF对旧应用程序和新的复杂应用程序几乎没有什么好处。

Many old complex applications are bulid follow "reduce the query complexity and roundrip to dataServer" that annouced by microsoft, Why EF break it? Should add support to multiple resultsets returned from a stored procedure in Founction Import,  and change Include() to return multiple resultsets to eliminate unnecessary comlex query and redundant data. or the EF can benefit little to the old applications and new complex applications.

推荐答案

每个查询都可以配置它,包括是笛卡尔积或多个结果集。 我认为NHibernate就是这样做的。
It would be nice to have it configurable per query, whether includes are Cartesian product or multiple results sets.  I think this is how NHibernate does it.


这篇关于请支持1)从存储过程返回的多个结果集2)更改Include()以返回多个结果集以消除不必要的复杂查询和冗余数据。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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