Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -0,0 +1,55 @@
//------------------------------------------------------------------------------
// <copyright file="Component.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.ComponentModel {
using System.Diagnostics;
/// <internalonly/>
internal sealed class CompModSwitches {
private static BooleanSwitch dynamicDiscoVirtualSearch;
private static TraceSwitch dynamicDiscoSearcher;
private static BooleanSwitch disableRemoteDebugging;
private static TraceSwitch remote;
public static BooleanSwitch DisableRemoteDebugging {
get {
if (disableRemoteDebugging == null) {
disableRemoteDebugging = new BooleanSwitch("Remote.Disable", "Disable remote debugging for web methods.");
}
return disableRemoteDebugging;
}
}
public static TraceSwitch DynamicDiscoverySearcher {
get {
if (dynamicDiscoSearcher == null) {
dynamicDiscoSearcher = new TraceSwitch("DynamicDiscoverySearcher", "Enable tracing for the DynamicDiscoverySearcher class.");
}
return dynamicDiscoSearcher;
}
}
public static BooleanSwitch DynamicDiscoveryVirtualSearch {
get {
if (dynamicDiscoVirtualSearch == null) {
dynamicDiscoVirtualSearch = new BooleanSwitch("DynamicDiscoveryVirtualSearch", "Force virtual search for DiscoveryRequestHandler class.");
}
return dynamicDiscoVirtualSearch;
}
}
public static TraceSwitch Remote {
get {
if (remote == null) {
remote = new TraceSwitch("Microsoft.WFC.Remote", "Enable tracing for remote method calls.");
}
return remote;
}
}
}
}

View File

@@ -0,0 +1,32 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration {
using System;
using System.Configuration;
using System.ComponentModel;
using System.IO;
using System.Security.Permissions;
using System.Threading;
using System.Xml;
public sealed class DiagnosticsElement : ConfigurationElement {
public DiagnosticsElement() : base() {
this.properties.Add(this.suppressReturningExceptions);
}
[ConfigurationProperty("suppressReturningExceptions", DefaultValue = false)]
public bool SuppressReturningExceptions {
get { return (bool)base[suppressReturningExceptions]; }
set { base[suppressReturningExceptions] = value; }
}
protected override ConfigurationPropertyCollection Properties {
get { return this.properties; }
}
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
readonly ConfigurationProperty suppressReturningExceptions = new ConfigurationProperty("suppressReturningExceptions", typeof(bool), false);
}
}

View File

@@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration
{
public enum PriorityGroup
{
High = 0,
Low = 1
}
}

View File

@@ -0,0 +1,56 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration
{
using System;
using System.Configuration;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Security.Permissions;
public sealed class ProtocolElement : ConfigurationElement
{
// These three constructors are used by the configuration system.
public ProtocolElement() : base()
{
this.properties.Add(this.name);
}
public ProtocolElement(WebServiceProtocols protocol) : this()
{
this.Name = protocol;
}
[ConfigurationProperty("name", IsKey = true, DefaultValue = WebServiceProtocols.Unknown)]
public WebServiceProtocols Name
{
get { return (WebServiceProtocols)base[this.name]; }
set
{
if (!IsValidProtocolsValue(value))
{
value = WebServiceProtocols.Unknown;
}
base[this.name] = value;
}
}
protected override ConfigurationPropertyCollection Properties
{
get { return this.properties; }
}
bool IsValidProtocolsValue(WebServiceProtocols value)
{
return Enum.IsDefined(typeof(WebServiceProtocols), value);
}
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
readonly ConfigurationProperty name = new ConfigurationProperty("name", typeof(WebServiceProtocols), WebServiceProtocols.Unknown, ConfigurationPropertyOptions.IsKey);
}
}

View File

@@ -0,0 +1,181 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration
{
using System;
using System.Collections;
using System.Configuration;
using System.Diagnostics;
using System.Globalization;
using System.Security.Permissions;
[ConfigurationCollection(typeof(ProtocolElement))]
public sealed class ProtocolElementCollection : ConfigurationElementCollection
{
public void Add(ProtocolElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
BaseAdd(element);
}
public void Clear()
{
BaseClear();
}
public bool ContainsKey(object key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
return this.BaseGet(key) != null;
}
protected override ConfigurationElement CreateNewElement()
{
return new ProtocolElement();
}
public void CopyTo(ProtocolElement[] array, int index)
{
if (array == null)
{
throw new ArgumentNullException("array");
}
((ICollection)this).CopyTo(array, index);
}
protected override Object GetElementKey(ConfigurationElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
ProtocolElement configElementKey = (ProtocolElement)element;
return configElementKey.Name.ToString();
}
public int IndexOf(ProtocolElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return BaseIndexOf(element);
}
public void Remove(ProtocolElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
BaseRemove(GetElementKey(element));
}
public void RemoveAt(object key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
BaseRemove(key);
}
public void RemoveAt(int index)
{
BaseRemoveAt(index);
}
internal void SetDefaults()
{
ProtocolElement httpSoap12Element = new ProtocolElement(WebServiceProtocols.HttpSoap12);
ProtocolElement httpSoapElement = new ProtocolElement(WebServiceProtocols.HttpSoap);
ProtocolElement httpPostLocalhostElement = new ProtocolElement(WebServiceProtocols.HttpPostLocalhost);
ProtocolElement documentationElement = new ProtocolElement(WebServiceProtocols.Documentation);
this.Add(httpSoap12Element);
this.Add(httpSoapElement);
this.Add(httpPostLocalhostElement);
this.Add(documentationElement);
}
public ProtocolElement this[object key]
{
get
{
if (key == null)
{
throw new ArgumentNullException("key");
}
ProtocolElement retval = (ProtocolElement)this.BaseGet(key);
if (retval == null)
{
throw new System.Collections.Generic.KeyNotFoundException(
string.Format(CultureInfo.InvariantCulture,
Res.GetString(Res.ConfigKeyNotFoundInElementCollection),
key.ToString()));
}
return retval;
}
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (key == null)
{
throw new ArgumentNullException("key");
}
// NOTE [ivelin : integration fix] The change bellow have the issue that it wont use the collection comparer
// if one is specified. We ( System.Configuration ) usually avoid having set_item[ key ] when the element contains
// the key and instead provide an Add( element ) method only.
if (this.GetElementKey(value).Equals(key))
{
if (BaseGet(key) != null)
{
BaseRemove(key);
}
Add(value);
}
else
{
throw new ArgumentException(string.Format(CultureInfo.InvariantCulture,
Res.GetString(Res.ConfigKeysDoNotMatch), this.GetElementKey(value).ToString(),
key.ToString()));
}
}
}
public ProtocolElement this[int index]
{
get
{
return (ProtocolElement)BaseGet(index);
}
set
{
if (BaseGet(index) != null)
{
BaseRemoveAt(index);
}
BaseAdd(index, value);
}
}
}
}

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration
{
using System.ComponentModel;
[Flags]
public enum WebServiceProtocols {
Unknown = 0x0,
HttpSoap = 0x1,
HttpGet = 0x2,
HttpPost = 0x4,
Documentation = 0x8,
HttpPostLocalhost = 0x10,
HttpSoap12 = 0x20,
// composite flag
AnyHttpSoap = 0x21,
}
}

View File

@@ -0,0 +1,51 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration {
using System;
using System.Configuration;
using System.ComponentModel;
using System.IO;
using System.Security.Permissions;
using System.Threading;
using System.Xml;
public sealed class SoapEnvelopeProcessingElement : ConfigurationElement {
// These three constructors are used by the configuration system.
public SoapEnvelopeProcessingElement() : base() {
this.properties.Add(this.readTimeout);
this.properties.Add(this.strict);
}
public SoapEnvelopeProcessingElement(int readTimeout) : this() {
this.ReadTimeout = readTimeout;
}
public SoapEnvelopeProcessingElement(int readTimeout, bool strict) : this() {
this.ReadTimeout = readTimeout;
this.IsStrict = strict;
}
[ConfigurationProperty("readTimeout", DefaultValue = int.MaxValue)]
[TypeConverter(typeof(InfiniteIntConverter))]
public int ReadTimeout {
get { return (int)base[this.readTimeout]; }
set { base[this.readTimeout] = value; }
}
[ConfigurationProperty("strict", DefaultValue = false)]
public bool IsStrict {
get { return (bool)base[strict]; }
set { base[strict] = value; }
}
protected override ConfigurationPropertyCollection Properties {
get { return this.properties; }
}
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
readonly ConfigurationProperty readTimeout = new ConfigurationProperty("readTimeout", typeof(int), int.MaxValue, new InfiniteIntConverter(), null, ConfigurationPropertyOptions.None);
readonly ConfigurationProperty strict = new ConfigurationProperty("strict", typeof(bool), false);
}
}

View File

@@ -0,0 +1,114 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration
{
using System;
using System.ComponentModel;
using System.Configuration;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Security.Permissions;
public sealed class SoapExtensionTypeElement : ConfigurationElement
{
// These three constructors are used by the configuration system.
public SoapExtensionTypeElement() : base()
{
this.properties.Add(this.group);
this.properties.Add(this.priority);
this.properties.Add(this.type);
}
public SoapExtensionTypeElement(string type, int priority, PriorityGroup group) : this()
{
this.Type = Type.GetType(type, true, true);
this.Priority = priority;
this.Group = group;
}
public SoapExtensionTypeElement(Type type, int priority, PriorityGroup group) :
this(type.AssemblyQualifiedName, priority, group)
{
}
[ConfigurationProperty("group", IsKey = true, DefaultValue = PriorityGroup.Low)]
public PriorityGroup Group
{
get { return (PriorityGroup)base[this.group]; }
set
{
if (Enum.IsDefined(typeof(PriorityGroup), value))
{
base[this.group] = value;
}
else
{
throw new ArgumentException(Res.GetString(Res.Invalid_priority_group_value), "value");
}
}
}
[ConfigurationProperty("priority", IsKey = true, DefaultValue = 0)]
[IntegerValidator(MinValue = 0)]
public int Priority
{
get { return (int)base[this.priority]; }
set { base[this.priority] = value; }
}
[ConfigurationProperty("type", IsKey = true)]
[TypeConverter(typeof(TypeTypeConverter))]
public Type Type
{
get {
return (Type)base[this.type];
}
set
{
base[this.type] = value;
}
}
protected override ConfigurationPropertyCollection Properties
{
get { return this.properties; }
}
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
readonly ConfigurationProperty group = new ConfigurationProperty("group", typeof(PriorityGroup), PriorityGroup.Low, new EnumConverter(typeof(PriorityGroup)), null, ConfigurationPropertyOptions.IsKey);
readonly ConfigurationProperty priority = new ConfigurationProperty("priority", typeof(int), 0, null, new IntegerValidator( 0, int.MaxValue ), ConfigurationPropertyOptions.IsKey);
readonly ConfigurationProperty type = new ConfigurationProperty("type", typeof(Type), null, new TypeTypeConverter(), null, ConfigurationPropertyOptions.IsKey);
}
class TypeTypeConverter : TypeAndNameConverter {
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
return base.CanConvertFrom(context, sourceType);
}
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) {
if (value is string) {
TypeAndName baseValue = (TypeAndName)base.ConvertFrom(context, culture, value);
return baseValue.type;
}
return base.ConvertFrom(context, culture, value);
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
if (destinationType == typeof(string)) {
TypeAndName castedValue = new TypeAndName((Type)value);
return base.ConvertTo(context, culture, castedValue, destinationType);
}
return base.ConvertTo(context, culture, value, destinationType);
}
}
}

View File

@@ -0,0 +1,167 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration
{
using System;
using System.Collections;
using System.Configuration;
using System.Diagnostics;
using System.Globalization;
using System.Security.Permissions;
[ConfigurationCollection(typeof(SoapExtensionTypeElement))]
public sealed class SoapExtensionTypeElementCollection : ConfigurationElementCollection
{
public void Add(SoapExtensionTypeElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
BaseAdd(element);
}
public void Clear()
{
BaseClear();
}
public bool ContainsKey(object key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
return this.BaseGet(key) != null;
}
protected override ConfigurationElement CreateNewElement()
{
return new SoapExtensionTypeElement();
}
public void CopyTo(SoapExtensionTypeElement[] array, int index)
{
if (array == null)
{
throw new ArgumentNullException("array");
}
((ICollection)this).CopyTo(array, index);
}
protected override Object GetElementKey(ConfigurationElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
// we allow multiple soap extensions with the same type to run.
return element;
}
public int IndexOf(SoapExtensionTypeElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return BaseIndexOf(element);
}
public void Remove(SoapExtensionTypeElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
BaseRemove(GetElementKey(element));
}
public void RemoveAt(object key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
BaseRemove(key);
}
public void RemoveAt(int index)
{
BaseRemoveAt(index);
}
public SoapExtensionTypeElement this[object key]
{
get
{
if (key == null)
{
throw new ArgumentNullException("key");
}
SoapExtensionTypeElement retval = (SoapExtensionTypeElement)this.BaseGet(key);
if (retval == null)
{
throw new System.Collections.Generic.KeyNotFoundException(
string.Format(CultureInfo.InvariantCulture,
Res.GetString(Res.ConfigKeyNotFoundInElementCollection),
key.ToString()));
}
return retval;
}
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (key == null)
{
throw new ArgumentNullException("key");
}
// NOTE [ivelin : integration fix] The change bellow have the issue that it wont use the collection comparer
// if one is specified. We ( System.Configuration ) usually avoid having set_item[ key ] when the element contains
// the key and instead provide an Add( element ) method only.
if (this.GetElementKey(value).Equals(key))
{
if (BaseGet(key) != null)
{
BaseRemove(key);
}
Add(value);
}
else
{
throw new ArgumentException(string.Format(CultureInfo.InvariantCulture,
Res.GetString(Res.ConfigKeysDoNotMatch), this.GetElementKey(value).ToString(),
key.ToString()));
}
}
}
public SoapExtensionTypeElement this[int index]
{
get
{
return (SoapExtensionTypeElement)BaseGet(index);
}
set
{
if (BaseGet(index) != null)
{
BaseRemoveAt(index);
}
BaseAdd(index, value);
}
}
}
}

View File

@@ -0,0 +1,99 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration {
using System;
using System.Configuration;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Security.Permissions;
public sealed class TypeElement : ConfigurationElement {
// These three constructors are used by the configuration system.
public TypeElement() : base() {
this.properties.Add(this.type);
}
public TypeElement(string type) : this() {
base[this.type] = new TypeAndName(type);
}
public TypeElement(Type type) : this(type.AssemblyQualifiedName) {
}
[ConfigurationProperty("type", IsKey = true)]
[TypeConverter(typeof(TypeAndNameConverter))]
public Type Type {
get { return ((TypeAndName)base[this.type]).type; }
set {
if (value == null) {
throw new ArgumentNullException("value");
}
base[this.type] = new TypeAndName(value);
}
}
protected override ConfigurationPropertyCollection Properties {
get { return this.properties; }
}
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
readonly ConfigurationProperty type = new ConfigurationProperty("type", typeof(TypeAndName), null, new TypeAndNameConverter(), null, ConfigurationPropertyOptions.IsKey);
}
class TypeAndName
{
public TypeAndName(string name)
{
this.type = Type.GetType(name, true, true);
this.name = name;
}
public TypeAndName(Type type)
{
this.type = type;
}
public override int GetHashCode()
{
return type.GetHashCode();
}
public override bool Equals(object comparand)
{
return type.Equals(((TypeAndName) comparand).type);
}
public readonly Type type;
public readonly string name;
}
class TypeAndNameConverter : TypeConverter {
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
if (sourceType == typeof(string)) {
return true;
}
return base.CanConvertFrom(context, sourceType);
}
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) {
if (value is string) {
return new TypeAndName((string) value);
}
return base.ConvertFrom(context, culture, value);
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
if (destinationType == typeof(string)) {
TypeAndName castedValue = (TypeAndName) value;
return castedValue.name == null ? castedValue.type.AssemblyQualifiedName : castedValue.name;
}
return base.ConvertTo(context, culture, value, destinationType);
}
}
}

View File

@@ -0,0 +1,168 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration
{
using System;
using System.Collections;
using System.Configuration;
using System.Diagnostics;
using System.Globalization;
using System.Security.Permissions;
[ConfigurationCollection(typeof(TypeElement))]
public sealed class TypeElementCollection : ConfigurationElementCollection
{
public void Add(TypeElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
BaseAdd(element);
}
public void Clear()
{
BaseClear();
}
public bool ContainsKey(object key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
return this.BaseGet(key) != null;
}
protected override ConfigurationElement CreateNewElement()
{
return new TypeElement();
}
public void CopyTo(TypeElement[] array, int index)
{
if (array == null)
{
throw new ArgumentNullException("array");
}
((ICollection)this).CopyTo(array, index);
}
protected override Object GetElementKey(ConfigurationElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
TypeElement configElementKey = (TypeElement)element;
return configElementKey.Type;
}
public int IndexOf(TypeElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return BaseIndexOf(element);
}
public void Remove(TypeElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
BaseRemove(GetElementKey(element));
}
public void RemoveAt(object key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
BaseRemove(key);
}
public void RemoveAt(int index)
{
BaseRemoveAt(index);
}
public TypeElement this[object key]
{
get
{
if (key == null)
{
throw new ArgumentNullException("key");
}
TypeElement retval = (TypeElement)this.BaseGet(key);
if (retval == null)
{
throw new System.Collections.Generic.KeyNotFoundException(
string.Format(CultureInfo.InvariantCulture,
Res.GetString(Res.ConfigKeyNotFoundInElementCollection),
key.ToString()));
}
return retval;
}
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (key == null)
{
throw new ArgumentNullException("key");
}
// NOTE [ivelin : integration fix] The change bellow have the issue that it wont use the collection comparer
// if one is specified. We ( System.Configuration ) usually avoid having set_item[ key ] when the element contains
// the key and instead provide an Add( element ) method only.
if (this.GetElementKey(value).Equals(key))
{
if (BaseGet(key) != null)
{
BaseRemove(key);
}
Add(value);
}
else
{
throw new ArgumentException(string.Format(CultureInfo.InvariantCulture,
Res.GetString(Res.ConfigKeysDoNotMatch), this.GetElementKey(value).ToString(),
key.ToString()));
}
}
}
public TypeElement this[int index]
{
get
{
return (TypeElement)BaseGet(index);
}
set
{
if (BaseGet(index) != null)
{
BaseRemoveAt(index);
}
BaseAdd(index, value);
}
}
}
}

View File

@@ -0,0 +1,189 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration
{
using System;
using System.Configuration;
using System.IO;
using System.Security.Permissions;
using System.Threading;
using System.Web.Configuration;
using System.Web.Hosting;
using System.Xml;
using System.Runtime.CompilerServices;
public sealed class WsdlHelpGeneratorElement : ConfigurationElement
{
// These three constructors are used by the configuration system.
public WsdlHelpGeneratorElement() : base()
{
this.properties.Add(this.href);
}
[FileIOPermission(SecurityAction.Assert, Unrestricted = true)]
string GetConfigurationDirectory()
{
PartialTrustHelpers.FailIfInPartialTrustOutsideAspNet();
return HttpRuntime.MachineConfigurationDirectory;
}
internal string HelpGeneratorVirtualPath
{
get { return this.virtualPath + this.Href; }
}
internal string HelpGeneratorPath
{
get { return Path.Combine(this.actualPath, this.Href); }
}
[ConfigurationProperty("href", IsRequired = true)]
public string Href
{
get { return (string)base[this.href]; }
set
{
if (value == null)
{
value = string.Empty;
}
if (this.needToValidateHref && value.Length > 0)
{
CheckIOReadPermission(this.actualPath, value);
}
base[this.href] = value;
}
}
protected override ConfigurationPropertyCollection Properties
{
get { return this.properties; }
}
protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey)
{
PartialTrustHelpers.FailIfInPartialTrustOutsideAspNet();
base.DeserializeElement(reader, serializeCollectionKey);
// Update paths
// If we're not running in the context of a web application then skip this setting.
ContextInformation context = this.EvaluationContext;
WebContext webContext = context.HostingContext as WebContext;
if (webContext == null)
{
return;
}
if (this.Href.Length == 0)
return;
string tempVirtualPath = webContext.Path;
string path = null;
// If the help page is not in the web app directory hierarchy (the case
// for those specified in machine.config like DefaultWsdlHelpGenerator.aspx)
// then we can't construct a true virtual path. This means that certain web
// form features that rely on relative paths won't work.
if (tempVirtualPath == null)
{
tempVirtualPath = HostingEnvironment.ApplicationVirtualPath;
if (tempVirtualPath == null)
tempVirtualPath = "";
path = GetConfigurationDirectory();
}
else
{
path = HostingEnvironment.MapPath(tempVirtualPath);
}
if (!tempVirtualPath.EndsWith("/", StringComparison.Ordinal))
{
tempVirtualPath += "/";
}
CheckIOReadPermission(path, this.Href);
this.actualPath = path;
this.virtualPath = tempVirtualPath;
this.needToValidateHref = true;
}
protected override void Reset(ConfigurationElement parentElement)
{
PartialTrustHelpers.FailIfInPartialTrustOutsideAspNet();
WsdlHelpGeneratorElement parent = (WsdlHelpGeneratorElement)parentElement;
ContextInformation context = this.EvaluationContext;
WebContext webContext = context.HostingContext as WebContext;
if (webContext != null)
{
string tempVirtualPath = webContext.Path;
bool isMachineConfig = tempVirtualPath == null;
this.actualPath = parent.actualPath;
if (isMachineConfig)
{
tempVirtualPath = HostingEnvironment.ApplicationVirtualPath;
}
if ((tempVirtualPath != null) && !tempVirtualPath.EndsWith("/", StringComparison.Ordinal))
{
tempVirtualPath += "/";
}
if ((tempVirtualPath == null) && (parentElement != null))
{
this.virtualPath = parent.virtualPath;
}
else if (tempVirtualPath != null)
{
this.virtualPath = tempVirtualPath;
}
}
base.Reset(parentElement);
}
[MethodImplAttribute(MethodImplOptions.NoInlining)]
internal void SetDefaults()
{
PartialTrustHelpers.FailIfInPartialTrustOutsideAspNet();
HttpContext context = HttpContext.Current;
if (context != null)
{
this.virtualPath = HostingEnvironment.ApplicationVirtualPath;
}
this.actualPath = this.GetConfigurationDirectory();
if ((this.virtualPath != null) && (!this.virtualPath.EndsWith("/", StringComparison.Ordinal)))
{
this.virtualPath += "/";
}
if ((this.actualPath != null) && (!this.actualPath.EndsWith(@"\", StringComparison.Ordinal)))
{
this.actualPath += "\\";
}
this.Href = "DefaultWsdlHelpGenerator.aspx";
CheckIOReadPermission(this.actualPath, this.Href);
this.needToValidateHref = true;
}
static void CheckIOReadPermission(string path, string file)
{
if (path == null)
return;
string fullPath = Path.GetFullPath(Path.Combine(path, file));
new FileIOPermission(FileIOPermissionAccess.Read, fullPath).Demand();
}
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
readonly ConfigurationProperty href = new ConfigurationProperty("href", typeof(string), null, ConfigurationPropertyOptions.IsRequired);
string virtualPath = null;
string actualPath = null;
bool needToValidateHref = false;
}
}

View File

@@ -0,0 +1,56 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration
{
using System;
using System.Configuration;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Security.Permissions;
public sealed class WsiProfilesElement : ConfigurationElement
{
// These three constructors are used by the configuration system.
public WsiProfilesElement() : base()
{
this.properties.Add(this.name);
}
public WsiProfilesElement(WsiProfiles name) : this()
{
this.Name = name;
}
[ConfigurationProperty("name", IsKey = true, DefaultValue = WsiProfiles.None)]
public WsiProfiles Name
{
get { return (WsiProfiles)base[this.name]; }
set
{
if (!IsValidWsiProfilesValue(value))
{
throw new ArgumentOutOfRangeException("value");
}
base[this.name] = value;
}
}
protected override ConfigurationPropertyCollection Properties
{
get { return this.properties; }
}
bool IsValidWsiProfilesValue(WsiProfiles value)
{
return Enum.IsDefined(typeof(WsiProfiles), value);
}
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
readonly ConfigurationProperty name = new ConfigurationProperty("name", typeof(WsiProfiles), WsiProfiles.None, ConfigurationPropertyOptions.IsKey);
}
}

View File

@@ -0,0 +1,174 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration
{
using System;
using System.Collections;
using System.Configuration;
using System.Diagnostics;
using System.Globalization;
using System.Security.Permissions;
[ConfigurationCollection(typeof(WsiProfilesElement))]
public sealed class WsiProfilesElementCollection : ConfigurationElementCollection
{
public void Add(WsiProfilesElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
BaseAdd(element);
}
public void Clear()
{
BaseClear();
}
public bool ContainsKey(object key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
return this.BaseGet(key) != null;
}
protected override ConfigurationElement CreateNewElement()
{
return new WsiProfilesElement();
}
public void CopyTo(WsiProfilesElement[] array, int index)
{
if (array == null)
{
throw new ArgumentNullException("array");
}
((ICollection)this).CopyTo(array, index);
}
protected override Object GetElementKey(ConfigurationElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
WsiProfilesElement configElementKey = (WsiProfilesElement)element;
return configElementKey.Name.ToString();
}
public int IndexOf(WsiProfilesElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return BaseIndexOf(element);
}
public void Remove(WsiProfilesElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
BaseRemove(GetElementKey(element));
}
public void RemoveAt(object key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
BaseRemove(key);
}
public void RemoveAt(int index)
{
BaseRemoveAt(index);
}
internal void SetDefaults()
{
WsiProfilesElement basic10Element = new WsiProfilesElement(WsiProfiles.BasicProfile1_1);
this.Add(basic10Element);
}
public WsiProfilesElement this[object key]
{
get
{
if (key == null)
{
throw new ArgumentNullException("key");
}
WsiProfilesElement retval = (WsiProfilesElement)this.BaseGet(key);
if (retval == null)
{
throw new System.Collections.Generic.KeyNotFoundException(
string.Format(CultureInfo.InvariantCulture,
Res.GetString(Res.ConfigKeyNotFoundInElementCollection),
key.ToString()));
}
return retval;
}
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (key == null)
{
throw new ArgumentNullException("key");
}
// NOTE [ivelin : integration fix] The change bellow have the issue that it wont use the collection comparer
// if one is specified. We ( System.Configuration ) usually avoid having set_item[ key ] when the element contains
// the key and instead provide an Add( element ) method only.
if (this.GetElementKey(value).Equals(key))
{
if (BaseGet(key) != null)
{
BaseRemove(key);
}
Add(value);
}
else
{
throw new ArgumentException(string.Format(CultureInfo.InvariantCulture,
Res.GetString(Res.ConfigKeysDoNotMatch), this.GetElementKey(value).ToString(),
key.ToString()));
}
}
}
public WsiProfilesElement this[int index]
{
get
{
return (WsiProfilesElement)BaseGet(index);
}
set
{
if (BaseGet(index) != null)
{
BaseRemoveAt(index);
}
BaseAdd(index, value);
}
}
}
}

View File

@@ -0,0 +1,79 @@
//------------------------------------------------------------------------------
// <copyright file="XmlFormatExtensionAttribute.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration {
using System;
/// <include file='doc\XmlFormatExtensionAttribute.uex' path='docs/doc[@for="XmlFormatExtensionAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
[AttributeUsage(AttributeTargets.Class)]
public sealed class XmlFormatExtensionAttribute : Attribute {
Type[] types;
string name;
string ns;
/// <include file='doc\XmlFormatExtensionAttribute.uex' path='docs/doc[@for="XmlFormatExtensionAttribute.XmlFormatExtensionAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public XmlFormatExtensionAttribute() {
}
/// <include file='doc\XmlFormatExtensionAttribute.uex' path='docs/doc[@for="XmlFormatExtensionAttribute.XmlFormatExtensionAttribute2"]/*' />
public XmlFormatExtensionAttribute(string elementName, string ns, Type extensionPoint1) : this(elementName, ns, new Type[] { extensionPoint1 }) {
}
/// <include file='doc\XmlFormatExtensionAttribute.uex' path='docs/doc[@for="XmlFormatExtensionAttribute.XmlFormatExtensionAttribute3"]/*' />
public XmlFormatExtensionAttribute(string elementName, string ns, Type extensionPoint1, Type extensionPoint2) : this(elementName, ns, new Type[] { extensionPoint1, extensionPoint2 }) {
}
/// <include file='doc\XmlFormatExtensionAttribute.uex' path='docs/doc[@for="XmlFormatExtensionAttribute.XmlFormatExtensionAttribute4"]/*' />
public XmlFormatExtensionAttribute(string elementName, string ns, Type extensionPoint1, Type extensionPoint2, Type extensionPoint3) : this(elementName, ns, new Type[] { extensionPoint1, extensionPoint2, extensionPoint3 }) {
}
/// <include file='doc\XmlFormatExtensionAttribute.uex' path='docs/doc[@for="XmlFormatExtensionAttribute.XmlFormatExtensionAttribute5"]/*' />
public XmlFormatExtensionAttribute(string elementName, string ns, Type extensionPoint1, Type extensionPoint2, Type extensionPoint3, Type extensionPoint4) : this(elementName, ns, new Type[] { extensionPoint1, extensionPoint2, extensionPoint3, extensionPoint4 }) {
}
/// <include file='doc\XmlFormatExtensionAttribute.uex' path='docs/doc[@for="XmlFormatExtensionAttribute.XmlFormatExtensionAttribute1"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public XmlFormatExtensionAttribute(string elementName, string ns, Type[] extensionPoints) {
this.name = elementName;
this.ns = ns;
this.types = extensionPoints;
}
/// <include file='doc\XmlFormatExtensionAttribute.uex' path='docs/doc[@for="XmlFormatExtensionAttribute.ExtensionPoints"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public Type[] ExtensionPoints {
get { return types == null ? new Type[0] : types; }
set { types = value; }
}
/// <include file='doc\XmlFormatExtensionAttribute.uex' path='docs/doc[@for="XmlFormatExtensionAttribute.Namespace"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public string Namespace {
get { return ns == null ? string.Empty : ns; }
set { ns = value; }
}
/// <include file='doc\XmlFormatExtensionAttribute.uex' path='docs/doc[@for="XmlFormatExtensionAttribute.ElementName"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public string ElementName {
get { return name == null ? string.Empty : name; }
set { name = value; }
}
}
}

View File

@@ -0,0 +1,48 @@
//------------------------------------------------------------------------------
// <copyright file="XmlFormatExtensionPointAttribute.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration {
using System;
/// <include file='doc\XmlFormatExtensionPointAttribute.uex' path='docs/doc[@for="XmlFormatExtensionPointAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
[AttributeUsage(AttributeTargets.Class)]
public sealed class XmlFormatExtensionPointAttribute : Attribute {
string name;
bool allowElements = true;
/// <include file='doc\XmlFormatExtensionPointAttribute.uex' path='docs/doc[@for="XmlFormatExtensionPointAttribute.XmlFormatExtensionPointAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public XmlFormatExtensionPointAttribute(string memberName) {
this.name = memberName;
}
/// <include file='doc\XmlFormatExtensionPointAttribute.uex' path='docs/doc[@for="XmlFormatExtensionPointAttribute.MemberName"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public string MemberName {
get { return name == null ? string.Empty : name; }
set { name = value; }
}
/// <include file='doc\XmlFormatExtensionPointAttribute.uex' path='docs/doc[@for="XmlFormatExtensionPointAttribute.AllowElements"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public bool AllowElements {
get { return allowElements; }
set { allowElements = value; }
}
}
}

View File

@@ -0,0 +1,54 @@
//------------------------------------------------------------------------------
// <copyright file="XmlFormatExtensionPrefixAttribute.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Services.Configuration {
using System;
/// <include file='doc\XmlFormatExtensionPrefixAttribute.uex' path='docs/doc[@for="XmlFormatExtensionPrefixAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class XmlFormatExtensionPrefixAttribute : Attribute {
string prefix;
string ns;
/// <include file='doc\XmlFormatExtensionPrefixAttribute.uex' path='docs/doc[@for="XmlFormatExtensionPrefixAttribute.XmlFormatExtensionPrefixAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public XmlFormatExtensionPrefixAttribute() {
}
/// <include file='doc\XmlFormatExtensionPrefixAttribute.uex' path='docs/doc[@for="XmlFormatExtensionPrefixAttribute.XmlFormatExtensionPrefixAttribute1"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public XmlFormatExtensionPrefixAttribute(string prefix, string ns) {
this.prefix = prefix;
this.ns = ns;
}
/// <include file='doc\XmlFormatExtensionPrefixAttribute.uex' path='docs/doc[@for="XmlFormatExtensionPrefixAttribute.Prefix"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public string Prefix {
get { return prefix == null ? string.Empty : prefix; }
set { prefix = value; }
}
/// <include file='doc\XmlFormatExtensionPrefixAttribute.uex' path='docs/doc[@for="XmlFormatExtensionPrefixAttribute.Namespace"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public string Namespace {
get { return ns == null ? string.Empty : ns; }
set { ns = value; }
}
}
}

View File

@@ -0,0 +1,57 @@
namespace System.Web.Services.Description {
using System.Xml.Serialization;
using System.Web.Services.Configuration;
/// <include file='doc\HttpFormatExtensions.uex' path='docs/doc[@for="HttpAddressBinding"]/*' />
[XmlFormatExtension("address", HttpBinding.Namespace, typeof(Port))]
public sealed class HttpAddressBinding : ServiceDescriptionFormatExtension {
string location;
/// <include file='doc\HttpFormatExtensions.uex' path='docs/doc[@for="HttpAddressBinding.Location"]/*' />
[XmlAttribute("location")]
public string Location {
get { return location == null ? string.Empty : location; }
set { location = value; }
}
}
/// <include file='doc\HttpFormatExtensions.uex' path='docs/doc[@for="HttpBinding"]/*' />
[XmlFormatExtension("binding", HttpBinding.Namespace, typeof(Binding))]
[XmlFormatExtensionPrefix("http", HttpBinding.Namespace)]
public sealed class HttpBinding : ServiceDescriptionFormatExtension {
string verb;
/// <include file='doc\HttpFormatExtensions.uex' path='docs/doc[@for="HttpBinding.Namespace"]/*' />
public const string Namespace = "http://schemas.xmlsoap.org/wsdl/http/";
/// <include file='doc\HttpFormatExtensions.uex' path='docs/doc[@for="HttpBinding.Verb"]/*' />
[XmlAttribute("verb")]
public string Verb {
get { return verb; }
set { verb = value; }
}
}
/// <include file='doc\HttpFormatExtensions.uex' path='docs/doc[@for="HttpOperationBinding"]/*' />
[XmlFormatExtension("operation", HttpBinding.Namespace, typeof(OperationBinding))]
public sealed class HttpOperationBinding : ServiceDescriptionFormatExtension {
string location;
/// <include file='doc\HttpFormatExtensions.uex' path='docs/doc[@for="HttpOperationBinding.Location"]/*' />
[XmlAttribute("location")]
public string Location {
get { return location == null ? string.Empty : location; }
set { location = value; }
}
}
/// <include file='doc\HttpFormatExtensions.uex' path='docs/doc[@for="HttpUrlEncodedBinding"]/*' />
[XmlFormatExtension("urlEncoded", HttpBinding.Namespace, typeof(InputBinding))]
public sealed class HttpUrlEncodedBinding : ServiceDescriptionFormatExtension {
}
/// <include file='doc\HttpFormatExtensions.uex' path='docs/doc[@for="HttpUrlReplacementBinding"]/*' />
[XmlFormatExtension("urlReplacement", HttpBinding.Namespace, typeof(InputBinding))]
public sealed class HttpUrlReplacementBinding : ServiceDescriptionFormatExtension {
}
}

View File

@@ -0,0 +1,35 @@
//------------------------------------------------------------------------------
// <copyright file="HttpGetProtocolImporter.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Services.Description {
using System.Web.Services.Protocols;
internal class HttpGetProtocolImporter : HttpProtocolImporter {
public HttpGetProtocolImporter() : base(false) { }
public override string ProtocolName {
get { return "HttpGet"; }
}
internal override Type BaseClass {
get {
if (Style == ServiceDescriptionImportStyle.Client) {
return typeof(HttpGetClientProtocol);
}
else {
return typeof(WebService);
}
}
}
protected override bool IsBindingSupported() {
HttpBinding httpBinding = (HttpBinding)Binding.Extensions.Find(typeof(HttpBinding));
if (httpBinding == null) return false;
if (httpBinding.Verb != "GET") return false;
return true;
}
}
}

Some files were not shown because too many files have changed in this diff Show More