Skip to content

Commit 4274d00

Browse files
authored
Remove configuration api. (#5358)
1 parent e6ea42b commit 4274d00

File tree

8 files changed

+6
-216
lines changed

8 files changed

+6
-216
lines changed

src/System.ServiceModel.Http/src/System/ServiceModel/NetHttpBinding.cs

-6
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ public NetHttpBinding(BasicHttpSecurityMode securityMode, bool reliableSessionEn
3232
ReliableSession.Enabled = reliableSessionEnabled;
3333
}
3434

35-
public NetHttpBinding(string configurationName)
36-
: base()
37-
{
38-
Initialize();
39-
}
40-
4135
private NetHttpBinding(BasicHttpSecurity security)
4236
: base()
4337
{

src/System.ServiceModel.NetTcp/src/System/ServiceModel/NetTcpBinding.cs

-9
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,6 @@ public NetTcpBinding(SecurityMode securityMode, bool reliableSessionEnabled) : t
3232
ReliableSession.Enabled = reliableSessionEnabled;
3333
}
3434

35-
public NetTcpBinding(string configurationName)
36-
: this()
37-
{
38-
if (!string.IsNullOrEmpty(configurationName))
39-
{
40-
throw new PlatformNotSupportedException();
41-
}
42-
}
43-
4435
[DefaultValue(ConnectionOrientedTransportDefaults.TransferMode)]
4536
public TransferMode TransferMode
4637
{

src/System.ServiceModel.Primitives/ref/System.ServiceModel.Duplex.cs

-10
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ public DuplexChannelFactory(Type callbackInstanceType, System.ServiceModel.Descr
3636
public DuplexChannelFactory(System.ServiceModel.InstanceContext callbackInstance, System.ServiceModel.Channels.Binding binding) : base(default(System.Type)) { }
3737
public DuplexChannelFactory(System.ServiceModel.InstanceContext callbackInstance, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(default(System.Type)) { }
3838
public DuplexChannelFactory(System.ServiceModel.InstanceContext callbackInstance, System.ServiceModel.Channels.Binding binding, string remoteAddress) : base(default(System.Type)) { }
39-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
40-
public DuplexChannelFactory(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName) : base(default(System.Type)) { }
41-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
42-
public DuplexChannelFactory(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(default(System.Type)) { }
4339
public override TChannel CreateChannel(System.ServiceModel.EndpointAddress address, System.Uri via) { return default(TChannel); }
4440
public TChannel CreateChannel(System.ServiceModel.InstanceContext callbackInstance) { return default(TChannel); }
4541
public TChannel CreateChannel(System.ServiceModel.InstanceContext callbackInstance, System.ServiceModel.EndpointAddress address) { return default(TChannel); }
@@ -49,11 +45,5 @@ public abstract partial class DuplexClientBase<TChannel> : System.ServiceModel.C
4945
{
5046
protected DuplexClientBase(System.ServiceModel.InstanceContext callbackInstance) { }
5147
protected DuplexClientBase(System.ServiceModel.InstanceContext callbackInstance, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) { }
52-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
53-
protected DuplexClientBase(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName) { }
54-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
55-
protected DuplexClientBase(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) { }
56-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
57-
protected DuplexClientBase(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, string remoteAddress) { }
5848
}
5949
}

src/System.ServiceModel.Primitives/ref/System.ServiceModel.Primitives.cs

-14
Original file line numberDiff line numberDiff line change
@@ -236,16 +236,12 @@ protected ChannelFactory() { }
236236
protected override System.TimeSpan DefaultCloseTimeout { get { return default; } }
237237
protected override System.TimeSpan DefaultOpenTimeout { get { return default; } }
238238
public System.ServiceModel.Description.ServiceEndpoint Endpoint { get { return default; } }
239-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
240-
protected virtual void ApplyConfiguration(string configurationName) { }
241239
protected abstract System.ServiceModel.Description.ServiceEndpoint CreateDescription();
242240
protected virtual System.ServiceModel.Channels.IChannelFactory CreateFactory() { return default; }
243241
protected internal void EnsureOpened() { }
244242
public T GetProperty<T>() where T : class { return default; }
245243
protected void InitializeEndpoint(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress address) { }
246244
protected void InitializeEndpoint(System.ServiceModel.Description.ServiceEndpoint endpoint) { }
247-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
248-
protected void InitializeEndpoint(string configurationName, System.ServiceModel.EndpointAddress address) { }
249245
protected override void OnAbort() { }
250246
protected override System.IAsyncResult OnBeginClose(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
251247
protected override System.IAsyncResult OnBeginOpen(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
@@ -262,10 +258,6 @@ public partial class ChannelFactory<TChannel> : System.ServiceModel.ChannelFacto
262258
public ChannelFactory(System.ServiceModel.Channels.Binding binding) { }
263259
public ChannelFactory(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) { }
264260
public ChannelFactory(System.ServiceModel.Description.ServiceEndpoint endpoint) { }
265-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
266-
public ChannelFactory(string endpointConfigurationName) { }
267-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
268-
public ChannelFactory(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) { }
269261
protected ChannelFactory(System.Type channelType) { }
270262
public TChannel CreateChannel() { return default; }
271263
public TChannel CreateChannel(System.ServiceModel.EndpointAddress address) { return default; }
@@ -284,12 +276,6 @@ public abstract partial class ClientBase<TChannel> : System.IDisposable, System.
284276
protected ClientBase() { }
285277
protected ClientBase(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) { }
286278
protected ClientBase(System.ServiceModel.Description.ServiceEndpoint endpoint) { }
287-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
288-
protected ClientBase(string endpointConfigurationName) { }
289-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
290-
protected ClientBase(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) { }
291-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
292-
protected ClientBase(string endpointConfigurationName, string remoteAddress) { }
293279
protected TChannel Channel { get { return default; } }
294280
public static CacheSetting CacheSetting { get { return default; } set { } }
295281
public System.ServiceModel.ChannelFactory<TChannel> ChannelFactory { get { return default; } }

src/System.ServiceModel.Primitives/src/System/ServiceModel/ChannelFactory.cs

+5-89
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ namespace System.ServiceModel
1414
{
1515
public abstract class ChannelFactory : CommunicationObject, IChannelFactory, IDisposable, IAsyncDisposable
1616
{
17-
private string _configurationName;
1817
private ClientCredentials _readOnlyClientCredentials;
1918
private object _openLock = new object();
2019

@@ -111,19 +110,6 @@ protected internal void EnsureOpened()
111110
}
112111
}
113112

114-
// configurationName can be:
115-
// 1. null: don't bind any per-endpoint config (load common behaviors only)
116-
// 2. "*" (wildcard): match any endpoint config provided there's exactly 1
117-
// 3. anything else (including ""): match the endpoint config with the same name
118-
protected virtual void ApplyConfiguration(string configurationName)
119-
{
120-
// This method is in the public contract but is not supported on CORECLR or NETNATIVE
121-
if (!String.IsNullOrEmpty(configurationName))
122-
{
123-
throw ExceptionHelper.PlatformNotSupported();
124-
}
125-
}
126-
127113
protected abstract ServiceEndpoint CreateDescription();
128114

129115
internal EndpointAddress CreateEndpointAddress(ServiceEndpoint endpoint)
@@ -145,14 +131,7 @@ protected virtual IChannelFactory CreateFactory()
145131

146132
if (Endpoint.Binding == null)
147133
{
148-
if (_configurationName != null)
149-
{
150-
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SRP.Format(SRP.SFxChannelFactoryNoBindingFoundInConfig1, _configurationName)));
151-
}
152-
else
153-
{
154-
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SRP.SFxChannelFactoryNoBindingFoundInConfigOrCode));
155-
}
134+
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SRP.SFxChannelFactoryNoBindingFoundInConfigOrCode));
156135
}
157136

158137
return ServiceChannelFactory.BuildChannelFactory(Endpoint, UseActiveAutoClose);
@@ -236,42 +215,20 @@ internal bool HasDuplexOperations()
236215
return false;
237216
}
238217

239-
protected void InitializeEndpoint(string configurationName, EndpointAddress address)
218+
protected void InitializeEndpoint(EndpointAddress address)
240219
{
241220
Endpoint = CreateDescription();
242-
243-
ServiceEndpoint serviceEndpointFromConfig = null;
244-
245-
// Project N and K do not support System.Configuration, but this method is part of Windows Store contract.
246-
// The configurationName==null path occurs in normal use.
247-
if (configurationName != null)
248-
{
249-
throw ExceptionHelper.PlatformNotSupported();
250-
// serviceEndpointFromConfig = ConfigLoader.LookupEndpoint(configurationName, address, this.serviceEndpoint.Contract);
251-
}
252-
253-
if (serviceEndpointFromConfig != null)
221+
if (address != null)
254222
{
255-
Endpoint = serviceEndpointFromConfig;
223+
Endpoint.Address = address;
256224
}
257-
else
258-
{
259-
if (address != null)
260-
{
261-
Endpoint.Address = address;
262-
}
263225

264-
ApplyConfiguration(configurationName);
265-
}
266-
_configurationName = configurationName;
267226
EnsureSecurityCredentialsManager(Endpoint);
268227
}
269228

270229
protected void InitializeEndpoint(ServiceEndpoint endpoint)
271230
{
272231
Endpoint = endpoint ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(endpoint));
273-
274-
ApplyConfiguration(null);
275232
EnsureSecurityCredentialsManager(Endpoint);
276233
}
277234

@@ -288,7 +245,6 @@ protected void InitializeEndpoint(Binding binding, EndpointAddress address)
288245
Endpoint.Address = address;
289246
}
290247

291-
ApplyConfiguration(null);
292248
EnsureSecurityCredentialsManager(Endpoint);
293249
}
294250

@@ -416,32 +372,7 @@ public ChannelFactory()
416372
{
417373
ServiceModelActivity.Start(activity, SRP.Format(SRP.ActivityConstructChannelFactory, typeof(TChannel).FullName), ActivityType.Construct);
418374
}
419-
InitializeEndpoint((string)null, null);
420-
}
421-
}
422-
423-
// TChannel provides ContractDescription, attr/config [TChannel,name] provides Address,Binding
424-
public ChannelFactory(string endpointConfigurationName)
425-
: this(endpointConfigurationName, null)
426-
{
427-
}
428-
429-
// TChannel provides ContractDescription, attr/config [TChannel,name] provides Binding, provide Address explicitly
430-
public ChannelFactory(string endpointConfigurationName, EndpointAddress remoteAddress)
431-
: this(typeof(TChannel))
432-
{
433-
using (ServiceModelActivity activity = DiagnosticUtility.ShouldUseActivity ? ServiceModelActivity.CreateBoundedActivity() : null)
434-
{
435-
if (DiagnosticUtility.ShouldUseActivity)
436-
{
437-
ServiceModelActivity.Start(activity, SRP.Format(SRP.ActivityConstructChannelFactory, typeof(TChannel).FullName), ActivityType.Construct);
438-
}
439-
if (endpointConfigurationName == null)
440-
{
441-
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(endpointConfigurationName));
442-
}
443-
444-
InitializeEndpoint(endpointConfigurationName, remoteAddress);
375+
InitializeEndpoint((EndpointAddress)null);
445376
}
446377
}
447378

@@ -615,21 +546,6 @@ private void ReflectOnCallbackInstance(ServiceEndpoint endpoint)
615546
}
616547
}
617548

618-
//Static funtions to create channels
619-
protected static TChannel CreateChannel(String endpointConfigurationName)
620-
{
621-
ChannelFactory<TChannel> channelFactory = new ChannelFactory<TChannel>(endpointConfigurationName);
622-
623-
if (channelFactory.HasDuplexOperations())
624-
{
625-
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SRP.Format(SRP.SFxInvalidStaticOverloadCalledForDuplexChannelFactory1, channelFactory._channelType.Name)));
626-
}
627-
628-
TChannel channel = channelFactory.CreateChannel();
629-
SetFactoryToAutoClose(channel);
630-
return channel;
631-
}
632-
633549
public static TChannel CreateChannel(Binding binding, EndpointAddress endpointAddress)
634550
{
635551
ChannelFactory<TChannel> channelFactory = new ChannelFactory<TChannel>(binding, endpointAddress);

src/System.ServiceModel.Primitives/src/System/ServiceModel/ClientBase.cs

-15
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,6 @@ protected ClientBase()
5555
throw new PlatformNotSupportedException(SRP.ConfigurationFilesNotSupported);
5656
}
5757

58-
protected ClientBase(string endpointConfigurationName)
59-
{
60-
throw new PlatformNotSupportedException(SRP.ConfigurationFilesNotSupported);
61-
}
62-
63-
protected ClientBase(string endpointConfigurationName, string remoteAddress)
64-
{
65-
throw new PlatformNotSupportedException(SRP.ConfigurationFilesNotSupported);
66-
}
67-
68-
protected ClientBase(string endpointConfigurationName, EndpointAddress remoteAddress)
69-
{
70-
throw new PlatformNotSupportedException(SRP.ConfigurationFilesNotSupported);
71-
}
72-
7358
protected ClientBase(Binding binding, EndpointAddress remoteAddress)
7459
{
7560
if (binding == null)

0 commit comments

Comments
 (0)