我正在尝试将 WCF 数据服务与包含在可移植库中的 POCO 数据模型一起使用。服务器端使用模型没有问题,但是在客户端,当提要实现时,我得到这个错误:
类型为“PortableEntities.Customers”的名称为“Orders”的属性具有“Structural”类型,但预计为“Navigation”类型
客户端似乎无法具体化未实现为 DataServiceCollection 的关系(可移植库不可用的类型)。
有没有办法使用其他 ICollection 类型,如 HashSet 或 List?
这是我的便携式库中的模型类(来自 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