ScopeElement.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Discovery / System / ServiceModel / Discovery / Configuration / ScopeElement.cs / 1305376 / ScopeElement.cs

                            //---------------------------------------------------------------- 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//---------------------------------------------------------------

namespace System.ServiceModel.Discovery.Configuration 
{
    using System.Configuration; 
    using System.Runtime; 
    using SR2 = System.ServiceModel.Discovery.SR;
 
    [Fx.Tag.XamlVisible(false)]
    public sealed class ScopeElement : ConfigurationElement
    {
        ConfigurationPropertyCollection properties; 

        [ConfigurationProperty(ConfigurationStrings.Scope, Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)] 
        [CallbackValidator(CallbackMethodName = "ScopeValidatorCallback", Type = typeof(ScopeElement))] 
        public Uri Scope
        { 
            get
            {
                return (Uri)base[ConfigurationStrings.Scope];
            } 

            set 
            { 
                base[ConfigurationStrings.Scope] = value;
            } 
        }

        protected override ConfigurationPropertyCollection Properties
        { 
            get
            { 
                if (this.properties == null) 
                {
                    ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection(); 

                    properties.Add(
                        new ConfigurationProperty(
                        ConfigurationStrings.Scope, 
                        typeof(Uri),
                        null, 
                        null, 
                        new CallbackValidator(typeof(Uri), new ValidatorCallback(ScopeElement.ScopeValidatorCallback)),
                        System.Configuration.ConfigurationPropertyOptions.IsRequired | System.Configuration.ConfigurationPropertyOptions.IsKey)); 

                    this.properties = properties;
                }
                return this.properties; 
            }
        } 
 
        internal static void ScopeValidatorCallback(object scope)
        { 
            if ((scope != null) && !((Uri)scope).IsAbsoluteUri)
            {
                throw FxTrace.Exception.AsError(new ArgumentException(SR2.DiscoveryConfigInvalidScopeUri(scope)));
            } 
        }
    } 
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

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