Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WCF数据服务:拦截所有查询_C#_Wcf_Wcf Data Services_Queryinterceptor - Fatal编程技术网

C# WCF数据服务:拦截所有查询

C# WCF数据服务:拦截所有查询,c#,wcf,wcf-data-services,queryinterceptor,C#,Wcf,Wcf Data Services,Queryinterceptor,我一直在尝试通过开发一种定制的每会话身份验证机制来保护我的WCF数据服务,该机制基于多个标准来识别客户端。然后,我想截获所有查询和非查询请求的基础上,这个认证的结果。截取查询没有问题,但由于我可能有很多表,我一直在寻找一种方法来截取所有位于同一位置的查询 例如,而不是 [QueryInterceptor("Entities")] public Expression<Func<Entity, Boolean> FilterEntities(){ return x=>

我一直在尝试通过开发一种定制的每会话身份验证机制来保护我的WCF数据服务,该机制基于多个标准来识别客户端。然后,我想截获所有查询和非查询请求的基础上,这个认证的结果。截取查询没有问题,但由于我可能有很多表,我一直在寻找一种方法来截取所有位于同一位置的查询

例如,而不是

[QueryInterceptor("Entities")]
public Expression<Func<Entity, Boolean> FilterEntities(){
    return x=> IsAuthenticated;
}
[QueryInterceptor(“实体”)]
公开表达未经认证;
}

[QueryInterceptor("*")]
public Expression<Func<T, Boolean> FilterEntities<T>(){
    return x=> IsAuthenticated;
} // As a logical description only, of course it won't work as it is
[QueryInterceptor(“*”)]
公开表达未经认证;
}//仅作为逻辑描述,它当然不能按原样工作

那么,是否有任何方法可以过滤WCF数据服务中的所有查询和非查询请求?

使用QueryInterceptor目前似乎无法实现,您必须手动添加每个实体集名称:

但您可以参考本系列博客,在WCF数据服务中进行身份验证。

使用QueryInterceptor目前似乎无法实现,您必须手动添加每个实体集名称:

但您可以参考本系列博客,在WCF数据服务中进行身份验证。