简体   繁体   English

WCF数据服务中的拦截器

[英]Interceptors in WCF data service

using ChangeInterceptors I can perform custom modifications on the objects currently being processed. 使用ChangeInterceptors,我可以对当前正在处理的对象执行自定义修改。 Using QueryInterceptors I can only influence whether an object is returned by the wcf or not. 使用QueryInterceptors,我只能影响wcf是否返回对象。 Is there a way to modify an object or a collection of objects after retrieving them via EF from the database and before sending them? 通过数据库从EF检索对象或发送对象之前,是否可以修改对象或对象集合? The objects in question have navigation properties which are requested, too. 所讨论的对象也具有所要求的导航属性。 So retrieving them via WebGet is not an option. 因此,通过WebGet检索它们不是一种选择。

Any hints or ideas are highly appreciated 任何提示或想法都受到高度赞赏

I had come across a similar requirement, and I found that WCF DS is very data-centric and limited when it comes to doing such things. 我遇到了类似的要求,并且我发现WCF DS在执行此类操作时非常以数据为中心并且受到限制。 You might want to look into WCF DS Service Actions but I doubt that will address your requirement. 您可能想研究WCF DS服务操作,但是我怀疑这是否可以满足您的要求。

The solution I can think of is to retrieve your entities using a WebGet method, and then on the client use the DataServiceQuery.Expand to retrieve the navigation properties. 我能想到的解决方案是使用WebGet方法检索您的实体,然后在客户端上使用DataServiceQuery.Expand检索导航属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM