基于透明代理技术创建的WCF实例打开与关闭WCF通道
基于透明代理技术创建的WCF实例打开与关闭WCF通道
C# Code:
private CSFrameworkV5.WCFContract.ISystemSecurityService client
{
get { return WCFFactory.Create<CSFrameworkV5.WCFContract.ISystemSecurityService>(); }
}
#region IBridge_User Members
public bool SetLockState(string account, bool isLock)
{
byte[] loginTicket = WebServiceSecurity.EncryptLoginer(Loginer.CurrentUser);
return client.U_SetLockState(loginTicket, account, isLock);
}
//来源:C/S框架网(www.csframework.com) QQ:23404761
private CSFrameworkV5.WCFContract.ISystemSecurityService client
{
get { return WCFFactory.Create<CSFrameworkV5.WCFContract.ISystemSecurityService>(); }
}
#region IBridge_User Members
public bool SetLockState(string account, bool isLock)
{
byte[] loginTicket = WebServiceSecurity.EncryptLoginer(Loginer.CurrentUser);
return client.U_SetLockState(loginTicket, account, isLock);
}
//来源:C/S框架网(www.csframework.com) QQ:23404761
ICommunicationObject.Open
ICommunicationObject.Close
关闭WCF通道:
C# Code:
public bool SetLockState(string account, bool isLock)
{
ISystemSecurityService svc = this.client;
try
{
byte[] loginTicket = WebServiceSecurity.EncryptLoginer(Loginer.CurrentUser);
return svc.U_SetLockState(loginTicket, account, isLock);
}
finally
{
(svc as ICommunicationObject).Close();
}
}
//来源:C/S框架网(www.csframework.com) QQ:23404761
public bool SetLockState(string account, bool isLock)
{
ISystemSecurityService svc = this.client;
try
{
byte[] loginTicket = WebServiceSecurity.EncryptLoginer(Loginer.CurrentUser);
return svc.U_SetLockState(loginTicket, account, isLock);
}
finally
{
(svc as ICommunicationObject).Close();
}
}
//来源:C/S框架网(www.csframework.com) QQ:23404761
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网