如何配置WCF方法可见性? [英] How can I configure WCF method visibility?

查看:97
本文介绍了如何配置WCF方法可见性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我的产品情况依赖于WCF。



一个功能要求配置WCF方法,以便根据设置值参数化其可见性。



我的意思是,如果配置文件中的标志为true,则方法是可操作的,而ServiceContract的一部分,如果没有,则方法无法访问,也不会出现在运行时。



提前致谢!

Hi All,

I''ve got a situation for a product relies on WCF.

One feature asks for configure a WCF method in order to parametrize its visibility depending on a setting value.

I mean, if a flag inside config file is true, method is operable and part of ServiceContract, if not, method cannot be accessed and does not appear on runtime.

Thanks in advance!

推荐答案

服务合同中的每个操作都在WSDL中公开。这就是WCF的工作方式。因此每个使用服务WSDL的客户端都可以使用它。

如果你想隐藏基于flag的方法,那么使用if case来执行方法if flag true。

否则做不执行任何操作。
each operation from the service contract is exposed in WSDL. That is how WCF works. So each client consuming service WSDL can "use" it.
If you want to hide method based on flag then use if case to execute method if flag true.
Otherwise do not execute anything.


这篇关于如何配置WCF方法可见性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆