c# - LINQ DBcontext is taking too long to load data -


when execute stored procedure in sql server management studio, returns results in less 1 second, when try load data via linq , code, takes 5 seconds. quick suggestions?

[global::system.data.linq.mapping.functionattribute(name="dbo.sp_select_mydata")] public isingleresult<sp_select_mydataresult> sp_select_mydata([global::system.data.linq.mapping.parameterattribute(dbtype="varchar(50)")] string bname) {     iexecuteresult result = this.executemethodcall(this, ((methodinfo)(methodinfo.getcurrentmethod())), bname);     return ((isingleresult<sp_select_mydataresult>)(result.returnvalue)); } 

this line takes time

iexecuteresult result = this.executemethodcall(this, ((methodinfo)(methodinfo.getcurrentmethod())), bname); 

i comment don't have enough reputation yet.

does run faster second time? if so, you're describing sounds resolved using compiled queries, according post, compiled queries not work stored procedures: http://aspguy.wordpress.com/2008/08/15/speed-up-linq-to-sql-with-compiled-linq-queries/

can write query in linq instead , use compiled queries or have in sproc?


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -