This question is locked. New answers and comments are not allowed.
Im having trouble with the loadwith method options. It seems simple enough, but I cant get it to work the way I want. Using the scaffolding/service generator for webapi crud basics, the Get method doesnt serialize the navigation properties, which is the way it should be.
However, when I make a simple linq query, it serializes the navigation properties (I only want some to load, not everything). Explicitly adding loadwith or include doesnt do a thing.
For example:
It returns all of the navigation properties, except for children (needed for treeview). Then as a test I try:
This gives me the same result, even though I dont specify anything. I restarted VS to clear any caches and also checked if there were any other global fetchplans loaded.
Am I overlooking something obvious (all the data is correct btw) ?
However, when I make a simple linq query, it serializes the navigation properties (I only want some to load, not everything). Explicitly adding loadwith or include doesnt do a thing.
For example:
using (var db = new EntitiesModel1()) { FetchStrategy fs = new FetchStrategy(); fs.LoadWith<ThinkDataOA.General_Organisation>(o => o.children); fs.MaxFetchDepth = 3; IQueryable<General_Organisation> emp = from general_organisation in db.General_Organisations.LoadWith(fs) select general_organisation; return emp.ToList<General_Organisation>(); }It returns all of the navigation properties, except for children (needed for treeview). Then as a test I try:
using (var db = new EntitiesModel1()) { IEnumerable<General_Organisation> emp = db.General_Organisations.ToList<General_Organisation>(); return emp; // }This gives me the same result, even though I dont specify anything. I restarted VS to clear any caches and also checked if there were any other global fetchplans loaded.
Am I overlooking something obvious (all the data is correct btw) ?