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
- HostingMessageProperty.cs
- CapacityStreamGeometryContext.cs
- FreezableOperations.cs
- XPathPatternParser.cs
- FormViewInsertEventArgs.cs
- ThreadInterruptedException.cs
- Size.cs
- XmlSerializationWriter.cs
- MinimizableAttributeTypeConverter.cs
- Int16Converter.cs
- SqlConnectionHelper.cs
- XmlNamespaceManager.cs
- GridViewColumnCollectionChangedEventArgs.cs
- SQLCharsStorage.cs
- ModulesEntry.cs
- ComplexTypeEmitter.cs
- WeakEventManager.cs
- SiteMapNodeCollection.cs
- DataGridViewSelectedColumnCollection.cs
- MiniCustomAttributeInfo.cs
- ConfigsHelper.cs
- EventHandlingScope.cs
- ControlCachePolicy.cs
- TypedRowGenerator.cs
- PointAnimationClockResource.cs
- ProvidePropertyAttribute.cs
- NetworkInformationPermission.cs
- ViewStateException.cs
- MsmqDecodeHelper.cs
- Compiler.cs
- ScrollItemProviderWrapper.cs
- InvalidateEvent.cs
- TdsRecordBufferSetter.cs
- CorrelationManager.cs
- SafeNativeMethods.cs
- COSERVERINFO.cs
- InvalidFilterCriteriaException.cs
- XmlSchemaGroupRef.cs
- SrgsElementList.cs
- MarkupObject.cs
- TextTreeTextNode.cs
- ScriptModule.cs
- DataPagerFieldItem.cs
- Dictionary.cs
- AuthenticationException.cs
- ExpandableObjectConverter.cs
- GeneralTransformGroup.cs
- GetPageCompletedEventArgs.cs
- TextMessageEncodingBindingElement.cs
- PersonalizationStateQuery.cs
- JsonServiceDocumentSerializer.cs
- CommandID.cs
- TdsParserStateObject.cs
- EventData.cs
- CodeTypeReferenceExpression.cs
- SharedPersonalizationStateInfo.cs
- BuildProviderCollection.cs
- RegisteredHiddenField.cs
- ExecutionScope.cs
- MissingManifestResourceException.cs
- AutomationPropertyInfo.cs
- RawContentTypeMapper.cs
- ProcessThreadCollection.cs
- SerializationInfo.cs
- AppDomainUnloadedException.cs
- HttpServerVarsCollection.cs
- X509ScopedServiceCertificateElement.cs
- HttpListenerException.cs
- ContainerControl.cs
- ClientWindowsAuthenticationMembershipProvider.cs
- TextBreakpoint.cs
- _SslStream.cs
- CodeComment.cs
- OleDbInfoMessageEvent.cs
- FontCollection.cs
- WebBrowserBase.cs
- odbcmetadatafactory.cs
- ValuePattern.cs
- SignedXml.cs
- CodeStatement.cs
- DataSourceHelper.cs
- LayoutSettings.cs
- URLString.cs
- ValidationErrorEventArgs.cs
- DataGridViewLinkColumn.cs
- XamlTemplateSerializer.cs
- ISFTagAndGuidCache.cs
- TemplateDefinition.cs
- RadioButton.cs
- WebServicesInteroperability.cs
- CqlQuery.cs
- AuthenticationModulesSection.cs
- SubpageParagraph.cs
- Missing.cs
- TokenBasedSetEnumerator.cs
- Int32CollectionConverter.cs
- XsdSchemaFileEditor.cs
- Maps.cs
- ObjectAssociationEndMapping.cs
- ChangeInterceptorAttribute.cs