WCF Data Services and Portable Library RRS feed

  • Question

  • Hi, 

    I'm trying to use WCF Data Services with a POCO data model contained in a Portable library. The server side has no problem to use the model, but on the client side, when the feed is materialized, I get this error :

    A property with name 'Orders' on type 'PortableEntities.Customers' has kind 'Structural', but it is expected to be of kind 'Navigation'

    The client is unable to materialized a relation that is not implemented as a DataServiceCollection (a type not available to portable libraries). Is using a portable library for my model supported by WCF Data Services?

    Here is the model class in my portable library (from Northwind) :

    Partial Public Class Customers
        Public Property ID As String
        Public Property CompanyName As String
        Public Property ContactName As String
        Public Property ContactTitle As String
        Public Property Address As String
        Public Property City As String
        Public Property Region As String
        Public Property PostalCode As String
        Public Property Country As String
        Public Property Phone As String
        Public Property Fax As String

        Public Overridable Property Orders As ICollection(Of Orders) = New HashSet(Of Orders)
        Public Overridable Property CustomerDemographics As ICollection(Of CustomerDemographics) = New HashSet(Of CustomerDemographics)

    End Class

    Monday, January 14, 2013 4:22 PM


  • The problem was the Id on the Orders class. In a portable library, we cannot use the DataServiceKey attribut, but we can follow a convention. In Northwind database, the table is named Orders and so the generated class.

    In order to follow the convention, I renamed my class Order instead of Orders. This fits the convention (Order with and OrderId). 

    • Marked as answer by Jo clem Tuesday, January 15, 2013 2:51 PM
    Tuesday, January 15, 2013 2:50 PM