资源简介
OPC 基金组织公开的最新OPC Server 4.0 for .NET,是开发OPC难得的开源项目
代码片段和文件信息
/**********************************************************************
* Copyright © 2009 2010 2011 2012 OPC Foundation Inc.
*
* The source code and all binaries built with the OPC .NET 3.0 source
* code are subject to the terms of the Express Interface Public
* License (Xi-PL). See http://www.opcfoundation.org/License/Xi-PL/
*
* The source code may be distributed from an OPC member company in
* its original or modified form to its customers and to any others who
* have software that needs to interoperate with the OPC member‘s OPC
* .NET 3.0 products. No other redistribution is permitted.
*
* You must not remove this notice or any other from this software.
*
*********************************************************************/
using System;
using System.ServiceModel;
namespace Xi.Common.Support
{
///
/// This class is used to properly close a WCF client proxy. It aborts or closes
/// the proxy based on the channel status and whether an exception is encountered.
/// It has two calling methods one where the proxy has a short life and the other
/// to be used when the proxy is held over the life of a single method.
///
///
/// Usage 1: Short lived proxy
/// void SomeMethod()
/// {
/// SomeWcfProxy proxy = new SomeWcfProxy();
/// using (new ChannelCloser(proxy))
/// {
/// proxy.MakeCall();
/// ...
/// }
/// }
///
/// Usage 2: Long lived proxy
/// void CreateProxy()
/// {
/// SomeWcfProxy proxy = new SomeWcfProxy();
/// ...
/// }
/// void DestroyProxy()
/// {
/// ChannelCloser.Close(proxy);
/// }
///
public class ChannelCloser : IDisposable
{
private readonly ICommunicationobject _channel;
///
/// Constructs a WCF channel closer object
///
/// WCF proxy object
public ChannelCloser(object channelObj)
{
if (!(channelObj is ICommunicationobject))
throw new ArgumentException(“Channel object must implement ICommunicationobject“);
_channel = (ICommunicationobject)channelObj;
}
///
/// Properly releases and closes the held WCF proxy
///
public void Dispose()
{
Close(_channel);
}
///
/// This method closes the passed proxy object
///
///
public static void Close(object obj)
{
if (obj != null)
{
var channelObj = obj as ICommunicationobject;
if (channelObj == null)
throw new ArgumentException(“Channel object must implement ICommunicationobject“ “obj“);
// if the channel faults you cannot Close/Dispose it - instead you have to Abort it
if (channelObj.State == CommunicationState.Faulted)
channelObj.Abort();
else if (channelObj.State != CommunicationState.Closed)
{
try
{
channelObj.Close();
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-09-06 15:02 Xi Contracts\Data\
文件 2551 2012-09-06 11:33 Xi Contracts\Data\AddDataob
文件 3106 2012-09-06 11:33 Xi Contracts\Data\AlarmCondition.cs
文件 2444 2012-09-06 11:33 Xi Contracts\Data\AlarmDesc
文件 1479 2012-09-06 11:33 Xi Contracts\Data\AlarmEnabledState.cs
文件 2377 2012-09-06 11:33 Xi Contracts\Data\AlarmMessageData.cs
文件 2245 2012-09-06 11:33 Xi Contracts\Data\AlarmState.cs
文件 4931 2012-09-06 11:33 Xi Contracts\Data\AlarmSummary.cs
文件 1410 2012-09-06 11:33 Xi Contracts\Data\AliasAndCalculation.cs
文件 2115 2012-09-06 11:33 Xi Contracts\Data\AliasResult.cs
文件 1957 2012-09-06 11:33 Xi Contracts\Data\AliasUpdate.cs
文件 3374 2012-09-06 11:33 Xi Contracts\Data\CategoryConfiguration.cs
文件 1924 2012-09-06 11:33 Xi Contracts\Data\DataJournalOptions.cs
文件 1402 2012-09-06 11:33 Xi Contracts\Data\DataJournalWriteResult.cs
文件 16674 2012-09-06 11:33 Xi Contracts\Data\DataValueArrays.cs
文件 11523 2012-09-06 11:33 Xi Contracts\Data\DataValueArraysWithAlias.cs
文件 4455 2012-09-06 11:33 Xi Contracts\Data\EndpointConfiguration.cs
文件 2419 2012-09-06 11:33 Xi Contracts\Data\EndpointConfigurationEx.cs
文件 3071 2012-09-06 11:33 Xi Contracts\Data\EndpointDefinition.cs
文件 6029 2012-09-06 11:33 Xi Contracts\Data\ErrorInfo.cs
文件 2870 2012-09-06 11:33 Xi Contracts\Data\EventId.cs
文件 1436 2012-09-06 11:33 Xi Contracts\Data\EventIdResult.cs
文件 4744 2012-09-06 11:33 Xi Contracts\Data\EventMessage.cs
文件 2206 2012-09-06 11:33 Xi Contracts\Data\EventMessageField.cs
文件 3677 2012-09-06 11:33 Xi Contracts\Data\EventType.cs
文件 4774 2012-09-06 11:33 Xi Contracts\Data\FilterCriterion.cs
文件 3792 2012-09-06 11:33 Xi Contracts\Data\FilterSet.cs
文件 3201 2012-09-06 11:33 Xi Contracts\Data\FindCriteria.cs
文件 14513 2012-09-06 11:33 Xi Contracts\Data\InstanceId.cs
文件 2378 2012-09-06 11:33 Xi Contracts\Data\JournalDataChangedValues.cs
文件 1799 2012-09-06 11:33 Xi Contracts\Data\JournalDataPropertyValue.cs
............此处省略164个文件信息
相关资源
- Intel(R) 82579V网卡驱动for server20033
- 最好用的FTP服务器
- 基于IBM eserver x440+FAStT700+VMware的系统整
- IBM CAW for Microsoft Cluster Server 简介
- 飞康NSS、CDP力保Windows Server 2008数据迁
- 64bit.server2008或win10下安装git服务器
- VisualSVN Server 4.0.0 企业破解版
- OPC统一架构UA协议文档 OPC UA
- 网上购物商城系统完整版
- Server 2008R2 AD服务器搭建图解
- Windows Server 2012 R2 上部署与安装AD域
- eServer z 系列服务器数据挖掘解决方案
- SAP Business One 中文版 + IBM eServer x 系列
- IBM eServer xSeries 445 EXP400在Linux下的双
- IBM eServer xSeries 365 EXP400在Windwos下的双
- IBM eServer xSeries 电信服务器
- 联想System X 3650 M5210RAID卡驱动 for ser
- WindowsServer2003.WindowsXP-KB926139-v2-x64-EN
- Wing FTP Server FTP服务器 v6.1.9
- Coinstor Backup Server数据容灾解决方案
-
HP Integrity Non
stop NS14000 Server产品手册 - telnet-server-0.17-25.i386.rpm
- VSuite Ramdisk Server V4.6.7 真正破解版(修
- IBM eServer zSeries力助德国电信屹立世界
- IBM eServer zSeries 力助德国电信集团
- WINDOWS SERVER 2003网卡驱动程序
- HP ML110 G7 Raid驱动 for server2012
- HP DL160G6 server 2012 smart array b110i阵列驱
- cesium实现supermap iServer数据服务查询及
- ffserver(windows下编译32位)
评论
共有 条评论