UseManagedPresentationBindingElement.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / UseManagedPresentationBindingElement.cs / 1 / UseManagedPresentationBindingElement.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 UseManagedPresentationBindingElement : BindingElement, IPolicyExportExtension 
    {
        public UseManagedPresentationBindingElement()
        {
        } 

        public override BindingElement Clone() 
        { 
            return new UseManagedPresentationBindingElement();
        } 

        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) 
            {
                UseManagedPresentationBindingElement settings =
                    context.BindingElements.Find();
 
                if (settings != null)
                { 
                    XmlDocument doc = new XmlDocument(); 

                    // UseUseManagedPresentation assertion 
                    XmlElement assertion = doc.CreateElement(UseManagedPresentationPolicyStrings.UseManagedPresentationPrefix,
                                                              UseManagedPresentationPolicyStrings.RequireFederatedIdentityProvisioningName,
                                                              UseManagedPresentationPolicyStrings.UseManagedPresentationNamespace);
 
                    context.GetBindingAssertions().Add(assertion);
                } 
            } 
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK