我正在从事一个使用EntitySpaces作为ORM的项目。
下面是一个简化的ItemCollection方法,它通过调用存储过程加载集合:
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;
}
}使用,我看到这是调用数据库的结果:
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是我最想要的,但是像往常一样,很难说服客户花一个月的开发时间来重构一个“工作”程序.所以这个选项被淘汰了,自动取款机。
发布于 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
https://stackoverflow.com/questions/17567138
复制相似问题