Monday 15 September 2014

c# - EF6: ObjectContext.ExecuteStoreQuery returns empty List -



c# - EF6: ObjectContext.ExecuteStoreQuery returns empty List -

i have next situation:

in database:

stored procedure: gp_get_location

in project (ef6) have dbcontext object

public list<location> getlocation(int locationid, int top = 100) { var prmlocationid = new sqlparameter("location_id", sqldbtype.int) { value = locationid }; var prmtop = new sqlparameter("top", sqldbtype.int) { value = top }; ((iobjectcontextadapter)this).objectcontext.commandtimeout = 300; var query = ((iobjectcontextadapter)this).objectcontext.executestorequery<location>(@"execute [dbo].[gp_get_location] @location_id, @top", prmlocationid, prmtop); homecoming query.tolist(); }

executing stored proc in managment studio this:

exec gp_get_location x, 100 -- returns 100 results exec gp_get_location y, 100 -- returns 100 results

executing context function:

getlocation(x, 100) //returns 100 results getlocation(y, 100) //not right - returns 0 results, no exception no warning 0

what reason unusual behaviour , how can trak root ?

c# sql-server entity-framework

No comments:

Post a Comment