Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / PrivacyNoticeBindingElement.cs / 1 / PrivacyNoticeBindingElement.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Channels { using System.ServiceModel.Configuration; using System.ServiceModel.Description; using System.Xml; public sealed class PrivacyNoticeBindingElement : BindingElement, IPolicyExportExtension { Uri url; int version; public PrivacyNoticeBindingElement() { this.url = null; } public PrivacyNoticeBindingElement( PrivacyNoticeBindingElement elementToBeCloned ) : base( elementToBeCloned ) { this.url = elementToBeCloned.url; this.version = elementToBeCloned.version; } public Uri Url { get { return this.url; } set { if (value == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value"); } this.url = value; } } public int Version { get { return this.version; } set { if ( value < 0 ) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value", value, SR.GetString(SR.ValueMustBePositive))); } this.version = value; } } public override BindingElement Clone() { return new PrivacyNoticeBindingElement(this); } public override T GetProperty(BindingContext context) { if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); } return context.GetInnerProperty (); } void IPolicyExportExtension.ExportPolicy(MetadataExporter exporter, PolicyConversionContext context) { if (context == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); if (context.BindingElements != null) { PrivacyNoticeBindingElement settings = context.BindingElements.Find (); if (settings != null) { XmlDocument doc = new XmlDocument(); // PrivacyNotice assertion XmlElement assertion = doc.CreateElement(PrivacyNoticePolicyStrings.PrivacyNoticePrefix, PrivacyNoticePolicyStrings.PrivacyNoticeName, PrivacyNoticePolicyStrings.PrivacyNoticeNamespace); assertion.InnerText = settings.Url.ToString(); assertion.SetAttribute(PrivacyNoticePolicyStrings.PrivacyNoticeVersionAttributeName, PrivacyNoticePolicyStrings.PrivacyNoticeNamespace, XmlConvert.ToString(settings.Version)); context.GetBindingAssertions().Add(assertion); } } } internal override bool IsMatch(BindingElement b) { if (b == null) return false; PrivacyNoticeBindingElement privacy = b as PrivacyNoticeBindingElement; if (privacy == null) return false; return (this.url == privacy.url && this.version == privacy.version); } } } // 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
- CodeGenHelper.cs
- Brush.cs
- DataGridViewBindingCompleteEventArgs.cs
- UnmanagedBitmapWrapper.cs
- AppSettingsExpressionBuilder.cs
- TextRangeProviderWrapper.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- TargetException.cs
- ConnectionsZone.cs
- httpapplicationstate.cs
- SpeechAudioFormatInfo.cs
- CodeMethodInvokeExpression.cs
- EntityDataSourceContainerNameItem.cs
- SafeRightsManagementEnvironmentHandle.cs
- EntityDataSourceState.cs
- SqlVisitor.cs
- MediaSystem.cs
- UdpAnnouncementEndpoint.cs
- SymLanguageType.cs
- ClientRolePrincipal.cs
- ObjectToIdCache.cs
- ServiceControllerDesigner.cs
- XsltConvert.cs
- CaseExpr.cs
- TextRangeEditTables.cs
- FieldNameLookup.cs
- PopupRootAutomationPeer.cs
- RuntimeResourceSet.cs
- CreateRefExpr.cs
- UIPermission.cs
- DataServiceQuery.cs
- DataKeyArray.cs
- DocumentXmlWriter.cs
- FillRuleValidation.cs
- Point3DKeyFrameCollection.cs
- IPCCacheManager.cs
- ComponentEditorPage.cs
- OdbcConnectionString.cs
- CodeDomLoader.cs
- ProtectedConfigurationProviderCollection.cs
- ListSourceHelper.cs
- BitmapMetadataEnumerator.cs
- AttachedPropertiesService.cs
- ProcessRequestArgs.cs
- ParameterDataSourceExpression.cs
- PnrpPermission.cs
- _ListenerResponseStream.cs
- PngBitmapDecoder.cs
- KeyedHashAlgorithm.cs
- XmlSchemaInferenceException.cs
- TableLayoutStyle.cs
- CodeRegionDirective.cs
- ProcessHostMapPath.cs
- DataServiceExpressionVisitor.cs
- ListMarkerSourceInfo.cs
- SliderAutomationPeer.cs
- XomlCompilerResults.cs
- FixedTextBuilder.cs
- PenContexts.cs
- TraceSource.cs
- SqlRemoveConstantOrderBy.cs
- CodeAttributeDeclarationCollection.cs
- ZipIOExtraFieldElement.cs
- Timeline.cs
- FixedSOMPageElement.cs
- MarkupObject.cs
- DataMisalignedException.cs
- ImageBrush.cs
- AnnotationObservableCollection.cs
- CompositeActivityValidator.cs
- FactoryGenerator.cs
- unsafenativemethodstextservices.cs
- CopyAction.cs
- SqlDependency.cs
- SecondaryViewProvider.cs
- GenericTypeParameterBuilder.cs
- BamlBinaryWriter.cs
- CaseStatement.cs
- RootBrowserWindowAutomationPeer.cs
- Rfc2898DeriveBytes.cs
- HandlerMappingMemo.cs
- SelectorItemAutomationPeer.cs
- AutoGeneratedFieldProperties.cs
- datacache.cs
- DBPropSet.cs
- IFormattable.cs
- GridViewColumnCollection.cs
- ResXResourceWriter.cs
- InvalidCastException.cs
- PageCodeDomTreeGenerator.cs
- LoginAutoFormat.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- TranslateTransform3D.cs
- ExceptionUtil.cs
- ValidationPropertyAttribute.cs
- CancellableEnumerable.cs
- XmlQuerySequence.cs
- WebPartsPersonalizationAuthorization.cs
- TextCollapsingProperties.cs
- XsdDuration.cs