wcf - LightSwitch - bulk-loading all requests into one using a domain service -


i need group data sql server database , since lightswitch doesn't support out-of-the-box use domain service according eric erhardt's guide.

however table contains several foreign keys , of course want correct related data shown in table (just doing in guide make key values show). solved adding relationship newly created entity this:

enter image description here

and domain service class looks this:

public class azuredbtestreportdata : domainservice     {         private countrylawdatadataobjectcontext context;         public countrylawdatadataobjectcontext context         {                         {                 if (this.context == null)                 {                     entityconnectionstringbuilder builder = new entityconnectionstringbuilder();                     builder.metadata =                       "res://*/countrylawdatadata.csdl|res://*/countrylawdatadata.ssdl|res://*/countrylawdatadata.msl";                     builder.provider = "system.data.sqlclient";                     builder.providerconnectionstring =                       webconfigurationmanager.connectionstrings["countrylawdatadata"].connectionstring;                      this.context = new countrylawdatadataobjectcontext(builder.connectionstring);                 }                 return this.context;             }         }          /// <summary>         /// override count method in order paging work correctly         /// </summary>         protected override int count<t>(iqueryable<t> query)         {             return query.count();         }          [query(isdefault = true)]         public iqueryable<ruleentrytest> getruleentrytest()         {             return this.context.ruleentries                 .select(g =>                     new ruleentrytest()                     {                         id = g.id,                         country = g.country,                         basefield = g.basefield                     });         }     }      public class ruleentrytest     {         [key]         public int id { get; set; }         public string country { get; set; }         public int basefield { get; set; }     } } 

it works , that, both country name , basefield loads autocomplete-boxes should, takes long time. 2 columns takes 5-10 seconds load 1 page.. , have 10 more columns haven't implemented yet.

the reason takes long time because each related data (each country , basefield) requires 1 request. loading page looks in fiddler:

enter image description here

this isn't acceptable @ all, should way of combining calls one, when loading same table without going through domain service.

so.. lot explaining, question is: there way can make related data load @ once or improve performance other way? should not take 10+ seconds load screen.

thanks or input!s

my ria service queries extremely fast, compared not using them, when i'm doing aggregation. might fact you're using "virtual relationships" (which can tell dotted lines between tables), you've created using ruleentrytest entity.

why original ruleentry entity not related both country & baseunit in lightswitch before start creating ria entity?

i haven't used fiddler see what's happening, i'd try creating "real" relationships, instead of "virtual" ones, & see if helps ria entity's performance.


Comments