Skip to Main Content

Oracle Developer Tools for Visual Studio

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to achieve parallel execution of two or more Entity Framework queries?

889038Apr 3 2012
Hi Everyone,
I'm creating some WCF service that use EF to query the database for the data that I need. The problem I have at the moment is that I have 2 or more EF LINQ queries which are declared and then executed to bring back my data... but this is in serial. One EF query is issued, and then the next one after that.
Does anyone know of a simple way to issue the queries in parallel? Or am I looking at async /parallel tasks to get the correct behaviour.

I know the DBContext is not thread safe, so I have no problem in declaring multiple contexts if required.

The code so far is as below:

+using (IMyContext ctx = MyFactory.GetInstance(request.UserId)) {+

Response response = new Response();

response.customer = ctx.GetCustomerByAccount(request.data.Account);
response.custInfo = ctx.GetCustInfoByAccount(request.data.Account);
response.address = ctx.GetDefaultAddressByAccount(request.data.Account);

return response;
+}+


Thanks in advance,
Nick
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 1 2012
Added on Apr 3 2012
0 comments
528 views