Skip to main content
Home Forums Silverlight Programming WCF RIA Services .NET RIA Service. Only one EMF entity per request?
10 replies. Latest Post by atbacarat on July 7, 2009.
(0)
Sergiy
Member
1 points
2 Posts
06-22-2009 10:54 AM |
I have two entities 'customer' and 'priv_person'. On the server side I create domain service with method:public IQueryable<CUSTOMER> GetCUSTOMERFull(){ return this.Context.CUSTOMER.Include("priv_person");}On the client side I call this query bycontext.LoadCUSTOMERFull() After this on server side i got complete set of data loaded : 'customer' and 'priv_person'. But during serialization the 'priv-person' data lost, and on the client side i haveonly 'customer' data. :) What I did wrong?
ColinBlair
Contributor
6579 points
1,291 Posts
06-22-2009 11:09 AM |
The RIA Services serializer does not automatically follow navigation properties. In the metadata file you need to put the [Include] attribute over the property. It is a little confusing, this wouldn't be the most asked question in this forum if it wasn't, but the include in your query and the include in the metadata mean very different things.
06-22-2009 11:53 AM |
All works! Thanks for your help!
theo67
524 points
177 Posts
06-30-2009 4:01 PM |
Are you able to update the child entity? I'm not...
atbacarat
13 points
40 Posts
07-01-2009 5:59 PM |
Im also still not able to update the child entity......
kylemc
Participant
1482 points
255 Posts
07-06-2009 10:32 AM |
Do you have an update method for the child entity? Even when you're loading it as a child, the supported operations are directly tied to the CRUD operations you define on the DomainService.
Kyle
07-06-2009 2:21 PM |
Hi Kyle, I touch the order header and the orderlines from code on the client. As soon as I touch an orderline the Silverlight client stops responding. I'm still able to navigate back, so it looks like a background thread doing some work. Now I sure hope the domain context isn't communicating with the domain service when I touch the orderline properties. I mean I hope one changeset will be constructed that holds the order header and the dirty orderlines. And the domain service will get one changeset and processes the header and lines in one go, so I have one database transaction, right?
07-06-2009 3:35 PM |
Your domain context won't communicate with the domain service unless you ask it to. There isn't anything automatic there (though you can enable periodic loads using DDS). You assumptions about a single changeset are correct so it's unlikely they're related to the client to lock up.
07-07-2009 5:07 AM |
kylemc:Do you have an update method for the child entity? Even when you're loading it as a child, the supported operations are directly tied to the CRUD operations you define on the DomainService.
I have added the Create/Insert/Update methods for my Orderline entity in my OrderDomainService and now I'm able to update the orderlines. I have started a new thread for this (http://silverlight.net/forums/p/107482/243819.aspx#243819)... Anyway I think it's strange to be forced to add the Insert/Delete/Update methods for every association that needs to be persisted.
07-07-2009 8:02 AM |
theo67:Anyway I think it's strange to be forced to add the Insert/Delete/Update methods for every association that needs to be persisted.
If you think of it that way then it would sound strange, but you are persisting entities not associations. It is just like in the database, you can select both Order and Orderline in a single select statement but inserts, updates, and deletes have to be done as seperate SQL statements to each table.
07-07-2009 2:08 PM |
Theo, is the OrderLines an entity in your Data Model? Im a bit confused, could you show me an axample of the CRUD you used to fix it. Thanks!