WcfHelper
来源:互联网 发布:ios商城项目源码 编辑:程序博客网 时间:2024/05/10 16:38
对WCF调用的简要封装,示例如下:
/// <summary> /// /*try { return WcfClientDispose.Using<AccountClient, Account>(new AccountClient(), client => { Account account = client.GetAccount(ptAccount, 1); }); } catch (Exception e) { }*/ /// </summary> public class WcfHelper { public static void Using<T, R>(T client, Action<T> action) where T : ICommunicationObject { try { action(client); client.Close(); } catch (CommunicationException exception) { client.Abort(); } catch (TimeoutException exception2) { client.Abort(); } catch (Exception exception3) { client.Abort(); throw exception3; } } public static R Using<T, R>(T client, Func<T, R> action) where T : ICommunicationObject where R : class { R local2; try { R local = action(client); client.Close(); local2 = local; } catch (CommunicationException exception) { client.Abort(); local2 = default(R); } catch (TimeoutException exception2) { client.Abort(); local2 = default(R); } catch (Exception exception3) { client.Abort(); throw exception3; } return local2; } }
- WcfHelper
- 正则表达式
- Swing GUI案例 - 2.需求说明
- 关于spotlight for Windows和spotlight for oracle的使用
- 实现HTTP页面、资源文件压缩
- 用Powerbuilder进行分布式应用开发三级体系结构
- WcfHelper
- Themida [2.0.2.0] (10-Jul-2008)
- 使用Ant从svn检出代码(check out resource from svn use ant)
- PowerBuilder在Windows server 2003上利用saveas()函數列印PDF類型檔案的作法
- JAVA基础学习-简单数据类型
- 哈佛图书馆自习室墙上的训言
- 不要一辈子靠技术生存
- java获取指定目录下所有文件
- yum错误