Reputation: 1513
I am doing a query with linq and entity framework. The database I'm using is Oracle. Here is the code :
Entities bdd = contextWrapper.GetContext();
data = (from table in bdd.COP_PRDTICSOURES
where (table.IDTTIC==ticketId && table.IDTPRD==productId)
select table).AsEnumerable();
When I look at the variable bdd.COP_PRDTIC_SOURES
using a debugger, it contains an entry matching my two criteria. However, after the execution of the query, the data
variable contains no result.
Is there something wrong with my syntax ?
Some additional information:
foreach
on the data after, so it's not a problem of lazy loading.Upvotes: 0
Views: 714
Reputation: 24903
AsEnumerable
does not load data from DB. Calling it you are not executing the actual query, just changing how it is going to be executed in its entirety.
Use ToArray
or ToList
instead to load data explicitly. Or call foreach
on this collection.
Upvotes: 2