I have a domain service specifically built for LightSwitch where I defined three entities.
- EntityA
- Id
- Field1
- EntityCollection<EntityC>
- EntityB
- Id
- Field2
- EntityCollection<EntityC>
- EntityC
- Id
- EntityA_Id
- EntityB_Id
- EntityA
- EntityB
- Field3
Ok, keys and associations are setup properly and functioning correctly.
I create a search screen for EntityC and I can see my data. However, for each group of rows where EntityA and EntityB are different, lightswitch calls the domain service multiple times. Even worse, it recreates the service object multiple times !!!!
I was trying to keep a connection and use some caching for EntityA and EntityB objects but since the domain service is recreated then I can’t.
Am I missing something here?
This is a WCF RIA issue not a LightSwitch specifuic issue. When you have, for example, a tree control, the nodes will be populated on demad. This article may provide some insight:
http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/53/Tree-Control-Hierarchical-Data-with-LightSwitch.aspx