| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- //------------------------------------------------------------------------------
- // Copyright (c) Microsoft Corporation. All rights reserved.
- //------------------------------------------------------------------------------
- namespace System.ServiceModel.Configuration
- {
- using System.Configuration;
- using System.Runtime;
- using System.Security;
- public sealed partial class ServiceElement : ConfigurationElement, IConfigurationContextProviderInternal
- {
- [Fx.Tag.SecurityNote(Critical = "Stores information used in a security decision.")]
- [SecurityCritical]
- EvaluationContextHelper contextHelper;
- public ServiceElement() : base() { }
- public ServiceElement(string serviceName)
- : this()
- {
- this.Name = serviceName;
- }
- [ConfigurationProperty(ConfigurationStrings.BehaviorConfiguration, DefaultValue = "")]
- [StringValidator(MinLength = 0)]
- public string BehaviorConfiguration
- {
- get { return (string)base[ConfigurationStrings.BehaviorConfiguration]; }
- set
- {
- if (String.IsNullOrEmpty(value))
- {
- value = String.Empty;
- }
- base[ConfigurationStrings.BehaviorConfiguration] = value;
- }
- }
- [ConfigurationProperty(ConfigurationStrings.DefaultCollectionName, Options = ConfigurationPropertyOptions.IsDefaultCollection)]
- public ServiceEndpointElementCollection Endpoints
- {
- get { return (ServiceEndpointElementCollection)base[ConfigurationStrings.DefaultCollectionName]; }
- }
- [ConfigurationProperty(ConfigurationStrings.Host, Options = ConfigurationPropertyOptions.None)]
- public HostElement Host
- {
- get { return (HostElement)base[ConfigurationStrings.Host]; }
- }
- [ConfigurationProperty(ConfigurationStrings.Name, Options = ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired)]
- [StringValidator(MinLength = 1)]
- public string Name
- {
- get { return (string)base[ConfigurationStrings.Name]; }
- set
- {
- if (String.IsNullOrEmpty(value))
- {
- value = String.Empty;
- }
- base[ConfigurationStrings.Name] = value;
- }
- }
- [Fx.Tag.SecurityNote(Critical = "Accesses critical field contextHelper.")]
- [SecurityCritical]
- protected override void Reset(ConfigurationElement parentElement)
- {
- this.contextHelper.OnReset(parentElement);
- base.Reset(parentElement);
- }
- ContextInformation IConfigurationContextProviderInternal.GetEvaluationContext()
- {
- return this.EvaluationContext;
- }
- [Fx.Tag.SecurityNote(Critical = "Accesses critical field contextHelper.",
- Miscellaneous = "RequiresReview -- the return value will be used for a security decision -- see comment in interface definition")]
- [SecurityCritical]
- ContextInformation IConfigurationContextProviderInternal.GetOriginalEvaluationContext()
- {
- return this.contextHelper.GetOriginalContext(this);
- }
- }
- }
|