arcbound08
arcbound08

Reputation: 107

Ria Service: Included Entities null when returning back to the service

I use the Include attribute on my properties, and they are transferred back properly to the client, but once I sent it back to the ria service for further processing the property are now null.

internal sealed class lSyncMetadata
{    
    private lSyncMetadata()
    {
    }

    public string ConflictMessage { get; set; }

    public DateTime DateInserted { get; set; }

    public Guid vValueId { get; set; }
    [Key]
    public Guid ID { get; set; }

    public bool IsConflict { get; set; }

    public bool IsReadyToSync { get; set; }

    public Guid SyncSet { get; set; }
    [Include]
    public vValue vValue { get; set; }    
}

Upvotes: 3

Views: 567

Answers (1)

Akash Kava
Akash Kava

Reputation: 39916

RIA Services Client does not serialize any property except value type and string, because usual navigation properties can lead to circular references and it will be impossible to determine what to send and what not to send. More over, in order to reduce network traffic and in order to maintain proper change tracking, ChangeSets are submitted by RIA Services but only for the entities it is tracking.

RIA Services are designed to replicate Entity Tracking on client side and you are expected to update, fetch navigation properties (related entities) on demand and you should let RIA Services manage what to send and what not to send.

However Include only works from Server to Client, it does not work from Client to Server, indeed if you make changes to navigation properties, RIA Services will determine and send ChangeSets correctly.

For anything apart from this, you will have to create a normal WCF Service or Web Service to make this work and access that from client.

Complex Types including only value types are supported, but they can not be of type Entity having Entity Key.

Upvotes: 1

Related Questions