[英]Entity Framework Model with inheritance and RIA Services
We have an entity framework model with has some inheritance in it. 我们有一个具有一些继承性的实体框架模型。
The following example is not the actuall model, but just to make my point... 以下示例不是实际模型,而是为了说明我的观点。
Let's say 比方说
Base class: Person Child classes: Employee, Customer 基本类别:人员子类别:雇员,客户
The database has been generated, the DomainService has been created and we can get to the data: 数据库已生成,DomainService已创建,我们可以获取数据:
lstCustomers.ItemsSource = context.Persons;
EntityQuery<Person> query = context.GetPeopleQuery().Take(4);
context.Load(query);
But how can I modify the query to only return Customers ? 但是,如何修改查询以仅返回客户?
Have you already tried the following: 您是否已经尝试过以下方法:
context.GetPeopleQuery().OfType<Customer>().Take(4)
I can imagine this doesn't have the required effect though, because the OfType
is probably evaluated client-side.. 我可以想象这没有达到要求的效果,因为
OfType
可能是在客户端评估的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.