首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从EntitySpaces加载存储过程比从SQL客户机加载存储过程花费的时间长40倍。

从EntitySpaces加载存储过程比从SQL客户机加载存储过程花费的时间长40倍。
EN

Stack Overflow用户
提问于 2013-07-10 09:32:16
回答 1查看 687关注 0票数 1

我正在从事一个使用EntitySpaces作为ORM的项目。

下面是一个简化的ItemCollection方法,它通过调用存储过程加载集合:

代码语言:javascript
复制
public partial class ItemCollection : esItemCollection
{
    public bool LoadItemsUsingSomeStoredProcedure(string aLotOfAttributes, out int totalCount)
    {
        // Set a lot of parameters
        esParameters parameters = new esParameters();
        // ...

        bool result = Load(esQueryType.StoredProcedure, "ItemsStoredProcedure", parameters);

        totalCount = (int) paramTotalCount.Value;

        return result;
    }
}

使用,我看到这是调用数据库的结果:

代码语言:javascript
复制
declare @p5 int
set @p5=485
exec [ItemsStoredProcedure] @Param1=4,@Param2=N'41',@Param3=N'SomeValue',@Param4=0,@TotalCount=@p5 output,@Param5=1,@Param6=25
select @p5

需要大约200秒的才能完成。

但是:当我在Studio (本地和远程)中运行相同的SQL片段时,大约需要4~5秒的才能完成。

知道为什么EntitySpaces调用比SQL中的调用要长40倍左右吗?有什么办法可以调试/改进吗?

PS:替换EntitySpaces是我最想要的,但是像往常一样,很难说服客户花一个月的开发时间来重构一个“工作”程序.所以这个选项被淘汰了,自动取款机。

EN

回答 1

Stack Overflow用户

发布于 2013-10-18 17:21:23

不要从Visual运行它,这是所有应用程序都存在的一个已知问题,EntitySpaces几乎没有给SqlClient添加任何时间,并且在所有ORM中实现最快。

http://www.entityspaces.net/www.entityspaces.net/blog/2010/08/26/The%20EntitySpaces%20ORMBattleNET%20Performance%20Numbers.aspx.html

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17567138

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档