Current Position:Home > How to achieve parallel execution of two or more Entity Framework queries?

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

Update:10-11Source: network consolidation
Advertisement
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

The Best Answer

Advertisement
Hi,
Although I don't understand why you need to serialized two programs
that have no dependency on each other, maybe the following code can help provided the programs are executed using specific tcodes.
  DATA: BEGIN OF USR_TABL OCCURS 10.
          INCLUDE STRUCTURE UINFO.
  DATA: END OF USR_TABL.
CONSTANTS: OPCODE_LIST LIKE TH_OPCODE VALUE 2.
  refresh USR_TABL.
  CALL 'ThUsrInfo' ID 'OPCODE' field OPCODE_LIST
    ID 'TAB' FIELD USR_TABL-SYS.
  sort usr_tabl by mandt bname.
You can check wheter the other program(tcode) is being run from itab USR_TABL, good luck.
Jeffrey Satriadi
  • How to achieve parallel execution of two or more Entity Framework queries? Update:10-11

    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

  • Parallel execution of multiple scripts Update:11-30

    Hi All, I understand that by using parallel hint we can achieve parallel execution of the queries(insert/update/delete). For my today's question I would like know if Parallelism can be achieved for the following scenario. I have a script with an inse

  • How to run multiple CodedUI Ordered Tests over multiple Test Agents for parallel execution using Test Controller Update:10-11

    we are using VS 2013, I need to run multiple Coded UI Ordered Tests in parallel on different agents. My requirement : Example:   I have 40 Coded UI Test scripts in single solution/project. i want to run in different OS environments(example 5 OS ).  I

  • Parallel Execution  against Normal Execution Update:11-30

    Hi, Can someone explain why in this case Serial Execution is faster although enabling parallel dml at session level , What are the possibilities to improve speed of executoin for parallel execution as i need to populate for 139 stores data having aro

  • Achieving Parallelism and avoiding Concurrency - Need Design Advice Update:11-30

    Requirement: Extract Data from the database using SSIS. Design Details: There are two tables ReportExtract and ReportExtractQueue. ReportExtract is a reference table and contains all the details related to the extracts. ReportExtractQueue is a Queue

  • 11g Parallel Execution on AIX 6 - SMT Enabled or Disabled? Update:10-11

    Greetings, I've had no luck searching for an answer to this question and I'm hoping someone can answer it: Can Oracle 11g Parallel Execution spread the "granules" of paralllism across the threads (logical cpus) in an AIX SMT enabled environment,

  • Parallel Execution questions Update:11-30

    Hi everyone, i have few questions about Parallel Execution. 1- Query Coordinator to scan the table, split up the table to the processes. But, each process take different number of rows. For example, in oracle 10g database architecture, thomas kyte ga

  • Parallel execution in a web template Update:11-30

    We have a web template with several queries. It is possible execute our queries with parallel execution? Thanks !!Hi Dani, currently all DP's are executed sequentially, because in general it would be possible that the dataproviders have influence on

  • Parallel execution of multiple test cases. Update:11-30

    Does flex unit 4.x version supports for parallel execution of multiple test cases? Any help will be greatly appreciated.No. Flash Player and AIR are single-threaded virtual machines. The only parallel execution one could do is during asynchronous tes

  • Parallel execution Update:11-30

    Hello! One of my views includes "decode" in which one of expressions is "select from ... " , all indexes and tables have degree of parallelism equal 1, and only sometimes I see parallel execution of guery. My question is whether can my