我正在使用 WCF Dataservice 从 DbContext 获取我的实体。我的实体有一个复杂的类型,其中包含一些元数据(DateTime 和 Guid 属性)。这是我的代码:
var uri = new Uri(webServiceUrl);
service = new DataServiceContext(uri);
localcontext = Globals.DbConnection.Create();
var list = service.CreateQuery<ActivityCode>("DbActivityCodes").Expand("Parent").Expand("ReplicaInfo").Where(x => x.ReplicaInfo.CreatedById != Guid.Empty);
此代码引发异常:
Cannot compare elements of type 'Crm.Objects.ReplicaInfo'. Only primitive types (such as Int32, String, and Guid) and entity types are supported.
另一个问题是,如果我删除Where query expression
我发现我的复杂类型 ReplicaInfo 是空的。
所以这是我的问题:
如何通过 WCF 数据服务获取复杂类型?
如何通过 WCF 数据服务按复杂类型进行过滤?