Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

Entity Framework with root object

$
0
0

I have db entity which has property as collection of another object. 

public class MyObject {

public int MyObjectId{get;set} public string Name{get; set;} public List<MyObject1> MyObjects1{get; set;} } public class MyObject1 {

public int MyObject1Id{get;set;}

public int MyObjectId{get; set} public string Name{get; set;} }

When I need entity MyObject from database I saw EF call two commands - first select to get MyObject and second get all MyObject1 where MyObjectId is from MyObject. MyObjectId is parameter - it is getById(int id) method in my repository. 

My question is … Call EF this two queries in parallel? Can I set it up to call it in parallel/not parallel? It doesn't matter in my private project (it is small project) but in our company I started with aggregate roots (domain design driven) and my colleague said me that you need to create more commands to call it in parallel. In result we have root table with three relation tables and we have 4 Task to get data from database in code. Then we have await for all task and create root object with child objects manually. 

How work with it? Can EF launch commands in parallel in this case?


Viewing all articles
Browse latest Browse all 1710

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>