Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / TransactionBridge / Microsoft / Transactions / Bridge / Configuration / ProtocolElementCollection.cs / 1 / ProtocolElementCollection.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
using DiagnosticUtility = Microsoft.Transactions.Bridge.DiagnosticUtility;
namespace Microsoft.Transactions.Bridge.Configuration
{
using System;
using System.Configuration;
using System.Xml;
[ConfigurationCollection(typeof(ProtocolElement))]
internal sealed partial class ProtocolElementCollection : ConfigurationElementCollection
{
const string wstxProtocolType10 = ("Microsoft.Transactions.Wsat.Protocol.PluggableProtocol10, "+
"Microsoft.Transactions.Bridge, "+
"Version=" +ThisAssembly.Version + ", " +
"Culture=neutral, "+
"PublicKeyToken="+AssemblyRef.MicrosoftPublicKey);
const string wstxProtocolType11 = ("Microsoft.Transactions.Wsat.Protocol.PluggableProtocol11, "+
"Microsoft.Transactions.Bridge, "+
"Version=" +ThisAssembly.Version + ", " +
"Culture=neutral, "+
"PublicKeyToken="+AssemblyRef.MicrosoftPublicKey);
public ProtocolElementCollection()
{
}
internal void SetDefaults()
{
ProtocolElement element1 = new ProtocolElement();
element1.Type = wstxProtocolType10;
ProtocolElement element2 = new ProtocolElement();
element2.Type = wstxProtocolType11;
this.Add(element1);
this.Add(element2);
this.ResetModified();
}
public ProtocolElement this[int index]
{
get
{
return (ProtocolElement)BaseGet(index);
}
set
{
if (BaseGet(index) != null)
{
BaseRemoveAt(index);
}
BaseAdd(index,value);
}
}
public void AssertBothWsatProtocolVersions()
{
bool found10 = false;
bool found11 = false;
foreach (ProtocolElement protocol in this)
{
if(protocol.Type == wstxProtocolType10)
found10 = true;
else if(protocol.Type == wstxProtocolType11)
found11 =true;
}
if((!found10 & found11) || (found10 & !found11))
{
string protocolStarted;
if(found10)
{
protocolStarted = " Wsat 1.0 ";
}
else
{
protocolStarted = " Wsat 1.1 ";
}
DiagnosticUtility.FailFast("Both Wsat protocol versions should be configured to start up. Only" + protocolStarted + "is started.");
}
}
public void Add(ProtocolElement element)
{
BaseAdd(element);
}
public void Clear()
{
BaseClear();
}
protected override ConfigurationElement CreateNewElement()
{
return new ProtocolElement();
}
protected override Object GetElementKey(ConfigurationElement element)
{
return ((ProtocolElement)element).Type;
}
public int IndexOf(ProtocolElement element)
{
return BaseIndexOf(element);
}
public void Remove(ProtocolElement element)
{
BaseRemove(element.Type);
}
public void Remove(string name)
{
BaseRemove(name);
}
public void RemoveAt(int index)
{
BaseRemoveAt(index);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BigInt.cs
- SqlNodeAnnotations.cs
- RuleDefinitions.cs
- _RequestCacheProtocol.cs
- BaseInfoTable.cs
- MediaTimeline.cs
- TextDecorationCollection.cs
- ColumnMapCopier.cs
- WindowsListViewItem.cs
- AnimationLayer.cs
- SettingsPropertyCollection.cs
- RectangleGeometry.cs
- StorageMappingItemCollection.cs
- CertificateReferenceElement.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- BufferedReadStream.cs
- CodeBinaryOperatorExpression.cs
- CacheAxisQuery.cs
- InteropBitmapSource.cs
- ContentPosition.cs
- ReadContentAsBinaryHelper.cs
- DataServiceProviderMethods.cs
- PartialClassGenerationTaskInternal.cs
- WindowsListViewItem.cs
- Model3D.cs
- XmlBaseWriter.cs
- MembershipSection.cs
- ToolBarPanel.cs
- TextClipboardData.cs
- XmlSchemaAnyAttribute.cs
- PreProcessInputEventArgs.cs
- ServiceOperationInfoTypeConverter.cs
- SchemaNamespaceManager.cs
- NameValueFileSectionHandler.cs
- ReadOnlyPropertyMetadata.cs
- UnicastIPAddressInformationCollection.cs
- ToolStripRendererSwitcher.cs
- BamlLocalizationDictionary.cs
- XmlCollation.cs
- ViewKeyConstraint.cs
- TCPClient.cs
- DataDocumentXPathNavigator.cs
- WorkflowShape.cs
- ReturnEventArgs.cs
- JsonQNameDataContract.cs
- ConvertTextFrag.cs
- ValidatorCollection.cs
- ReadOnlyCollectionBase.cs
- UpdateDelegates.Generated.cs
- QueryReaderSettings.cs
- SiteMapNodeItemEventArgs.cs
- SelectionHighlightInfo.cs
- InlineObject.cs
- SplitterEvent.cs
- UnsafeNativeMethods.cs
- QuadraticBezierSegment.cs
- CorePropertiesFilter.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- Brush.cs
- RoleService.cs
- EdmScalarPropertyAttribute.cs
- BindingWorker.cs
- Constant.cs
- ContentElement.cs
- DataGridDetailsPresenterAutomationPeer.cs
- HGlobalSafeHandle.cs
- EdmComplexPropertyAttribute.cs
- ToolStripOverflow.cs
- StylusPointPropertyInfoDefaults.cs
- DBBindings.cs
- BaseDataList.cs
- PrincipalPermissionMode.cs
- Page.cs
- WindowsNonControl.cs
- EventBuilder.cs
- MulticastDelegate.cs
- ContractHandle.cs
- WsdlExporter.cs
- SafeThemeHandle.cs
- XamlDesignerSerializationManager.cs
- SoapTransportImporter.cs
- _NegotiateClient.cs
- PingReply.cs
- GregorianCalendar.cs
- BaseResourcesBuildProvider.cs
- MetadataArtifactLoaderFile.cs
- HitTestResult.cs
- WebBrowserHelper.cs
- ActivityDesignerAccessibleObject.cs
- CultureInfoConverter.cs
- Executor.cs
- SoapElementAttribute.cs
- RequiredAttributeAttribute.cs
- EntitySqlException.cs
- GenericWebPart.cs
- ImageBrush.cs
- BamlWriter.cs
- MulticastDelegate.cs
- Utility.cs
- SqlMetaData.cs