Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / BindingCollectionElement.cs / 1 / BindingCollectionElement.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Configuration
{
using System.Collections.ObjectModel;
using System.ServiceModel.Channels;
using System.Configuration;
using System.ServiceModel;
using System.Security;
public abstract partial class BindingCollectionElement : ConfigurationElement, IConfigurationContextProviderInternal
{
string bindingName = string.Empty;
protected internal abstract Binding GetDefault();
public string BindingName
{
get
{
if (String.IsNullOrEmpty(this.bindingName))
{
this.bindingName = this.GetBindingName();
}
return this.bindingName;
}
}
public abstract Type BindingType
{
get;
}
public abstract ReadOnlyCollection ConfiguredBindings
{
get;
}
public abstract bool ContainsKey(string name);
///
/// Critical - uses SecurityCritical method UnsafeLookupCollection which elevates
/// Safe - does not leak config objects
///
[SecurityCritical, SecurityTreatAsSafe]
string GetBindingName()
{
string configuredSectionName = String.Empty;
ExtensionElementCollection collection = null;
Type extensionSectionType = this.GetType();
collection = ExtensionsSection.UnsafeLookupCollection(ConfigurationStrings.BindingExtensions, ConfigurationHelpers.GetEvaluationContext(this));
if (null == collection)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigExtensionCollectionNotFound,
ConfigurationStrings.BindingExtensions),
this.ElementInformation.Source,
this.ElementInformation.LineNumber));
}
for (int i = 0; i < collection.Count; i++)
{
ExtensionElement collectionElement = collection[i];
// Optimize for assembly qualified names.
if (collectionElement.Type.Equals(extensionSectionType.AssemblyQualifiedName, StringComparison.Ordinal))
{
configuredSectionName = collectionElement.Name;
break;
}
// Check type directly for the case that the extension is registered with something less than
// an full assembly qualified name.
Type collectionElementType = Type.GetType(collectionElement.Type, false);
if (null != collectionElementType && extensionSectionType.Equals(collectionElementType))
{
configuredSectionName = collectionElement.Name;
break;
}
}
if (String.IsNullOrEmpty(configuredSectionName))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigExtensionTypeNotRegisteredInCollection,
extensionSectionType.AssemblyQualifiedName,
ConfigurationStrings.BindingExtensions),
this.ElementInformation.Source,
this.ElementInformation.LineNumber));
}
return configuredSectionName;
}
protected internal abstract bool TryAdd(string name, Binding binding, Configuration config);
ContextInformation IConfigurationContextProviderInternal.GetEvaluationContext()
{
return this.EvaluationContext;
}
///
/// RequiresReview - the return value will be used for a security decision -- see comment in interface definition
///
ContextInformation IConfigurationContextProviderInternal.GetOriginalEvaluationContext()
{
DiagnosticUtility.DebugAssert("Not implemented: IConfigurationContextProviderInternal.GetOriginalEvaluationContext");
return null;
}
}
}
// 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
- BasicExpressionVisitor.cs
- MaterialGroup.cs
- QuerySettings.cs
- MemberRelationshipService.cs
- KeyValuePairs.cs
- ElementUtil.cs
- FormsAuthenticationUser.cs
- ObfuscationAttribute.cs
- Camera.cs
- UnknownBitmapDecoder.cs
- EntitySqlQueryCacheEntry.cs
- CodeMemberMethod.cs
- BasePattern.cs
- ReplacementText.cs
- PathFigureCollection.cs
- SecurityTokenParameters.cs
- OletxTransactionManager.cs
- SqlServer2KCompatibilityCheck.cs
- TypeBuilder.cs
- ISO2022Encoding.cs
- ContextMenuService.cs
- XmlLanguageConverter.cs
- PageSetupDialog.cs
- FreeFormPanel.cs
- BitmapImage.cs
- TypeToStringValueConverter.cs
- AsyncDataRequest.cs
- mediaeventargs.cs
- TextRange.cs
- TextRunTypographyProperties.cs
- TypeConverterHelper.cs
- IRCollection.cs
- PropertyCollection.cs
- LocalizabilityAttribute.cs
- CaseStatement.cs
- OdbcDataAdapter.cs
- RootBrowserWindowAutomationPeer.cs
- LayoutExceptionEventArgs.cs
- TemplatedMailWebEventProvider.cs
- ResourcesChangeInfo.cs
- FlowDocumentFormatter.cs
- SafeCryptContextHandle.cs
- OdbcInfoMessageEvent.cs
- InheritanceContextHelper.cs
- XmlUTF8TextWriter.cs
- XmlSchemaSimpleTypeUnion.cs
- RepeaterItem.cs
- TransformerConfigurationWizardBase.cs
- XmlDocumentFragment.cs
- EditingMode.cs
- LowerCaseStringConverter.cs
- CDSCollectionETWBCLProvider.cs
- EncryptedType.cs
- NamedPipeWorkerProcess.cs
- VisualProxy.cs
- ResourcePool.cs
- EntitySqlQueryState.cs
- CodeDomDecompiler.cs
- TraceContextEventArgs.cs
- WebPartHeaderCloseVerb.cs
- Focus.cs
- NativeDirectoryServicesQueryAPIs.cs
- CommandField.cs
- IndentTextWriter.cs
- NavigationEventArgs.cs
- SchemaElement.cs
- StatusBarItemAutomationPeer.cs
- PreProcessInputEventArgs.cs
- CatalogPartChrome.cs
- wpf-etw.cs
- WebSysDefaultValueAttribute.cs
- XmlElement.cs
- DBCommandBuilder.cs
- XsdDataContractExporter.cs
- ExpressionVisitorHelpers.cs
- TiffBitmapEncoder.cs
- FindCriteriaCD1.cs
- datacache.cs
- AnimationLayer.cs
- VisualStyleInformation.cs
- TextOptionsInternal.cs
- RegexReplacement.cs
- Visitor.cs
- DataGridViewMethods.cs
- ParserExtension.cs
- DbQueryCommandTree.cs
- TabItem.cs
- TreeBuilder.cs
- PageAsyncTaskManager.cs
- TabOrder.cs
- PropertyChangedEventArgs.cs
- SimpleFieldTemplateFactory.cs
- CaseExpr.cs
- PositiveTimeSpanValidator.cs
- EncryptedType.cs
- WebPartsPersonalizationAuthorization.cs
- ControlAdapter.cs
- ToolboxItemFilterAttribute.cs
- EventLogPermissionEntryCollection.cs
- TypedDataSetSchemaImporterExtension.cs