具有继承和 RIA 服务的实体框架模型
我们有一个实体框架模型,其中有一些继承。
下面的例子不是实际的模型,只是为了表明我的观点......
假设
基类:Person 子类: Employee、Customer
数据库已生成,DomainService 已创建,我们可以获取数据:
lstCustomers.ItemsSource = context.Persons;
EntityQuery<Person> query = context.GetPeopleQuery().Take(4);
context.Load(query);
但是如何修改查询以仅返回 Customers ?
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:
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否已经尝试过以下操作:
我可以想象这并没有达到所需的效果,因为
OfType
可能是在客户端进行评估的。Have you already tried the following:
I can imagine this doesn't have the required effect though, because the
OfType
is probably evaluated client-side..