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
- ProcessInfo.cs
- UIElement.cs
- VerificationAttribute.cs
- XmlILAnnotation.cs
- ListViewGroup.cs
- Pair.cs
- AudioStateChangedEventArgs.cs
- StrokeNodeOperations.cs
- DataGridTablesFactory.cs
- Menu.cs
- EventRecord.cs
- TraceRecord.cs
- WmlListAdapter.cs
- ImageMap.cs
- QueryCreatedEventArgs.cs
- SystemColors.cs
- ResourceManager.cs
- ContentIterators.cs
- httpstaticobjectscollection.cs
- AssertFilter.cs
- OneOfElement.cs
- AttributeTableBuilder.cs
- ListGeneralPage.cs
- Compiler.cs
- RedirectionProxy.cs
- DataObject.cs
- ImageListImageEditor.cs
- DataSourceProvider.cs
- AsyncSerializedWorker.cs
- TypeContext.cs
- MarkupExtensionReturnTypeAttribute.cs
- XmlTextWriter.cs
- WebRequestModulesSection.cs
- RegexStringValidatorAttribute.cs
- SeekableReadStream.cs
- SqlTriggerAttribute.cs
- DataGridItemCollection.cs
- BinaryFormatter.cs
- XmlUtilWriter.cs
- XsdBuilder.cs
- XMLSchema.cs
- Transform.cs
- ControlPager.cs
- WorkflowInlining.cs
- SmtpNtlmAuthenticationModule.cs
- EventItfInfo.cs
- ApplyTemplatesAction.cs
- Int32Storage.cs
- EntitySqlQueryCacheKey.cs
- AlignmentXValidation.cs
- ListItem.cs
- StringInfo.cs
- OracleLob.cs
- CacheHelper.cs
- DateTimeConverter.cs
- DBConnectionString.cs
- errorpatternmatcher.cs
- SqlRowUpdatingEvent.cs
- Compilation.cs
- StrongNameUtility.cs
- HttpBrowserCapabilitiesBase.cs
- CacheChildrenQuery.cs
- Span.cs
- ObjectListFieldsPage.cs
- WindowsSlider.cs
- DiscriminatorMap.cs
- HostedHttpRequestAsyncResult.cs
- ServiceBehaviorAttribute.cs
- Events.cs
- SubpageParaClient.cs
- JsonDeserializer.cs
- WebPartVerbCollection.cs
- MappingException.cs
- LongValidatorAttribute.cs
- DispatcherProcessingDisabled.cs
- XamlSerializer.cs
- DataBoundControl.cs
- EventBuilder.cs
- TcpTransportManager.cs
- EpmCustomContentSerializer.cs
- filewebrequest.cs
- EditCommandColumn.cs
- DbProviderSpecificTypePropertyAttribute.cs
- CodeTypeReferenceExpression.cs
- CompoundFileDeflateTransform.cs
- UnSafeCharBuffer.cs
- OperatingSystem.cs
- DocumentXPathNavigator.cs
- TextElementCollection.cs
- Grid.cs
- HashSet.cs
- ParameterCollection.cs
- PropertyNames.cs
- EndOfStreamException.cs
- SQLMoneyStorage.cs
- XmlSchemaProviderAttribute.cs
- AngleUtil.cs
- MatrixTransform3D.cs
- SynchronizedKeyedCollection.cs
- precedingsibling.cs