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
- XPathNavigatorReader.cs
- InputDevice.cs
- DictionaryEntry.cs
- Size3D.cs
- XhtmlBasicLabelAdapter.cs
- FrameworkElementAutomationPeer.cs
- webproxy.cs
- MissingFieldException.cs
- SessionSwitchEventArgs.cs
- AssertSection.cs
- MsmqIntegrationBinding.cs
- XPathAncestorQuery.cs
- DataBindingList.cs
- HttpEncoder.cs
- BreadCrumbTextConverter.cs
- IssuedTokenServiceElement.cs
- AuthenticationManager.cs
- Wizard.cs
- ValidatorUtils.cs
- SoapWriter.cs
- XamlGridLengthSerializer.cs
- ComplexTypeEmitter.cs
- CheckBox.cs
- StyleHelper.cs
- UserNamePasswordValidator.cs
- AttachedAnnotationChangedEventArgs.cs
- XmlLanguage.cs
- IItemProperties.cs
- Point3D.cs
- DataGridViewRowsAddedEventArgs.cs
- SqlBuffer.cs
- DecimalStorage.cs
- Button.cs
- AttributeEmitter.cs
- Visual3D.cs
- HeaderFilter.cs
- FileDialog.cs
- FieldNameLookup.cs
- HMACRIPEMD160.cs
- TdsParserStaticMethods.cs
- ItemsPresenter.cs
- StringUtil.cs
- XsdBuilder.cs
- XPathScanner.cs
- UrlMappingCollection.cs
- BaseTemplateBuildProvider.cs
- DataRecordObjectView.cs
- ExtendedPropertyDescriptor.cs
- XmlQualifiedName.cs
- XPathNodeHelper.cs
- XamlSerializationHelper.cs
- HwndMouseInputProvider.cs
- ConnectionStringSettingsCollection.cs
- ActivityTypeResolver.xaml.cs
- NotFiniteNumberException.cs
- SafeNativeMethods.cs
- MessageEventSubscriptionService.cs
- EntitySet.cs
- ScriptingRoleServiceSection.cs
- SmtpMail.cs
- List.cs
- SqlClientMetaDataCollectionNames.cs
- SolidBrush.cs
- ConsoleEntryPoint.cs
- Line.cs
- ButtonColumn.cs
- DataPagerFieldCommandEventArgs.cs
- UriTemplateEquivalenceComparer.cs
- CategoryGridEntry.cs
- GridLength.cs
- TreeIterator.cs
- FontNamesConverter.cs
- PropertyKey.cs
- FormViewInsertedEventArgs.cs
- MetadataItem_Static.cs
- _FtpControlStream.cs
- HashCodeCombiner.cs
- TypeHelper.cs
- NativeObjectSecurity.cs
- SQLUtility.cs
- SpecialFolderEnumConverter.cs
- SmiContext.cs
- NativeMethods.cs
- PathSegment.cs
- TypeConverterHelper.cs
- EventListenerClientSide.cs
- ExpressionBuilderContext.cs
- DynamicPropertyHolder.cs
- TitleStyle.cs
- TypeLibConverter.cs
- SqlUtils.cs
- FrameworkElement.cs
- WebPartsSection.cs
- RemotingHelper.cs
- FrameDimension.cs
- CollectionCodeDomSerializer.cs
- ChildChangedEventArgs.cs
- SqlParameterCollection.cs
- ValidationHelper.cs
- TreeViewDataItemAutomationPeer.cs