Skip to main content

Microsoft Silverlight

Answered Question .NET RIA Service. Only one EMF entity per request?RSS Feed

(0)

Sergiy
Sergiy

Member

Member

1 points

2 Posts

.NET RIA Service. Only one EMF entity per request?

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 by

context.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 have
only 'customer' data.


:)  What I did wrong?

ColinBlair
ColinBlair

Contributor

Contributor

6579 points

1,291 Posts

Answered Question

Re: .NET RIA Service. Only one EMF entity per request?

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.

-Colin Blair

http://www.RiaServicesBlog.net : The Elephant Guide to RIA Services
SLColinBlair on Twitter

Sergiy
Sergiy

Member

Member

1 points

2 Posts

Re: .NET RIA Service. Only one EMF entity per request?

All works! Thanks for your help!

theo67
theo67

Member

Member

524 points

177 Posts

Re: .NET RIA Service. Only one EMF entity per request?

Are you able to update the child entity? I'm not...

Theo.

atbacarat
atbacarat

Member

Member

13 points

40 Posts

Re: .NET RIA Service. Only one EMF entity per request?

 Im also still not able to update the child entity......

-Bacarat

http://www.facebook.com/ChadMCorrin : A link to my Facebook page

kylemc
kylemc

Participant

Participant

1482 points

255 Posts

Re: .NET RIA Service. Only one EMF entity per request?

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

theo67
theo67

Member

Member

524 points

177 Posts

Re: .NET RIA Service. Only one EMF entity per request?

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?

Theo.

kylemc
kylemc

Participant

Participant

1482 points

255 Posts

Re: .NET RIA Service. Only one EMF entity per request?

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.

Kyle

theo67
theo67

Member

Member

524 points

177 Posts

Re: .NET RIA Service. Only one EMF entity per request?

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.

Theo.

ColinBlair
ColinBlair

Contributor

Contributor

6579 points

1,291 Posts

Re: .NET RIA Service. Only one EMF entity per request?

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.

-Colin Blair

http://www.RiaServicesBlog.net : The Elephant Guide to RIA Services
SLColinBlair on Twitter

atbacarat
atbacarat

Member

Member

13 points

40 Posts

Re: .NET RIA Service. Only one EMF entity per request?

 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!

-Bacarat

http://www.facebook.com/ChadMCorrin : A link to my Facebook page
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities