Entity Framework 4 Any() -


basically have query need check see if data exists on table.

 bool isinuse;  isinuse = entity.h83saf_health_plan.h83saf_consent.any(); 

when used clutch trap query see going on, see query running this:

 select   "extent1"."active" "active",   "extent1"."is_complete" "is_complete",   "extent1"."date_created" "date_created",   "extent1"."date_modified" "date_modified",   "extent1"."created_by" "created_by",   "extent1"."modified_by" "modified_by"   ...more columns..natter, natter..  "h83ftf"."h83saf_consent" "extent1"  ("extent1"."health_plan_id" = 1) 

the query fine. have problem .any() statement. thought should happen query should quit abruptly when .any() condition met.

yet when query run, looks like query bringing on 18,000 records (which don't use) want see if data exists on other table if condition met - is, query hangs website while 18,000 rows executed .any() statement.

the first row has condition met understanding .any() should quit or stop moment condition met.

i tried firstordefault() yet still fetches 18000 rows in memory...

finally came conclusion using .any() on ef 5.0 not translate exist in oracle 11g - solution direct call , bring yes or no.


Comments