Note that there are some explanatory texts on larger screens.

plurals
  1. POSelf Tracking Entities Traffic Optimization
    text
    copied!<p>I'm working on a personal project using WPF with Entity Framework and Self Tracking Entities. I have a WCF web service which exposes some methods for the CRUD operations. Today I decided to do some tests and to see what actually travels over this service and even though I expected something like this, I got really disappointed. The problem is that for a simple update (or delete) operation for just one object - lets say <strong>Category</strong> I send to the server the whole object graph, including all of its parent categories, their items, child categories and their items, etc. I my case it was a 170 KB xml file on a really small database (2 main categories and about 20 total and about 60 items). I can't imagine what will happen if I have a really big database.</p> <p>I tried to google for some articles concerning traffic optimization with STE, but with no success, so I decided to ask here if somebody has done something similar, knows some good practices, etc.</p> <p>One of the possible ways I came out with is to get the data I need per object with more service calls:</p> <pre><code>return context.Categories.ToList();//only the categories ... return context.Items.ToList();//only the items </code></pre> <p>Instead of:</p> <pre><code>return context.Categories.Include("Items").ToList(); </code></pre> <p>This way the categories and the items will be separated and when making changes or deleting some objects the data sent over the wire will be less.</p> <p>Has any of you faced a similar problem and how did you solve it or did you solve it?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload