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
- HandleCollector.cs
- CategoryGridEntry.cs
- PartitionResolver.cs
- ProxyWebPartConnectionCollection.cs
- FloatSumAggregationOperator.cs
- TypeSystemHelpers.cs
- OperationInvokerTrace.cs
- Calendar.cs
- CommentEmitter.cs
- HttpHandlersSection.cs
- ValidationSummary.cs
- ExpandCollapseProviderWrapper.cs
- LoginName.cs
- Rijndael.cs
- PreviousTrackingServiceAttribute.cs
- CodeIndexerExpression.cs
- ImageAttributes.cs
- DataColumnSelectionConverter.cs
- WindowsListViewScroll.cs
- ObjectHandle.cs
- ArrayList.cs
- Rotation3DAnimationBase.cs
- Math.cs
- SqlTrackingWorkflowInstance.cs
- ActivatedMessageQueue.cs
- EncoderFallback.cs
- TemplateField.cs
- MediaCommands.cs
- AsyncOperation.cs
- ActivityCodeDomReferenceService.cs
- WorkflowNamespace.cs
- LogLogRecordHeader.cs
- CodeAccessPermission.cs
- MemoryMappedViewAccessor.cs
- ParameterRefs.cs
- HttpVersion.cs
- SubstitutionList.cs
- RootBuilder.cs
- Internal.cs
- SvcMapFileSerializer.cs
- MemberRelationshipService.cs
- TreeViewImageKeyConverter.cs
- Guid.cs
- DBCSCodePageEncoding.cs
- PaperSource.cs
- x509store.cs
- _FtpControlStream.cs
- DaylightTime.cs
- CodeArgumentReferenceExpression.cs
- EventToken.cs
- ParsedAttributeCollection.cs
- ResourceContainer.cs
- TransactionInformation.cs
- Selection.cs
- Console.cs
- BulletedListDesigner.cs
- TreeViewItemAutomationPeer.cs
- ObjectParameter.cs
- XmlSerializationWriter.cs
- SystemResources.cs
- ConfigurationValue.cs
- TemplateKeyConverter.cs
- ToolboxCategory.cs
- DataObjectPastingEventArgs.cs
- ToolStripItemGlyph.cs
- GlyphingCache.cs
- InfoCardArgumentException.cs
- TableAutomationPeer.cs
- DoubleAnimationBase.cs
- CursorConverter.cs
- ChangeNode.cs
- Filter.cs
- ButtonBase.cs
- DesignerValidationSummaryAdapter.cs
- AssemblyAttributesGoHere.cs
- ToolStripItemRenderEventArgs.cs
- AccessDataSourceWizardForm.cs
- Camera.cs
- Scripts.cs
- CellParagraph.cs
- AtomParser.cs
- CodeConstructor.cs
- HwndProxyElementProvider.cs
- WeakReferenceList.cs
- ResourceFallbackManager.cs
- InlineCollection.cs
- ValidationResult.cs
- EnvelopeVersion.cs
- HttpRuntimeSection.cs
- UnaryQueryOperator.cs
- FixedTextView.cs
- HttpCacheParams.cs
- SqlLiftIndependentRowExpressions.cs
- EdmMember.cs
- PKCS1MaskGenerationMethod.cs
- ExistsInCollection.cs
- ModelUIElement3D.cs
- SqlServer2KCompatibilityCheck.cs
- HostProtectionException.cs
- DirtyTextRange.cs