|
| 1 | +//------------------------------------------------------------------------------ |
| 2 | +// <auto-generated> |
| 3 | +// This code was generated by a tool. |
| 4 | +// |
| 5 | +// Changes to this file may cause incorrect behavior and will be lost if |
| 6 | +// the code is regenerated. |
| 7 | +// </auto-generated> |
| 8 | +//------------------------------------------------------------------------------ |
| 9 | + |
| 10 | +namespace ServiceReference1 |
| 11 | +{ |
| 12 | + |
| 13 | + |
| 14 | + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.1.0")] |
| 15 | + [System.ServiceModel.ServiceContractAttribute(ConfigurationName="ServiceReference1.ISecuredService")] |
| 16 | + public interface ISecuredService |
| 17 | + { |
| 18 | + |
| 19 | + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ISecuredService/Echo", ReplyAction="http://tempuri.org/ISecuredService/EchoResponse")] |
| 20 | + System.Threading.Tasks.Task<string> EchoAsync(string value); |
| 21 | + } |
| 22 | + |
| 23 | + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.1.0")] |
| 24 | + public interface ISecuredServiceChannel : ServiceReference1.ISecuredService, System.ServiceModel.IClientChannel |
| 25 | + { |
| 26 | + } |
| 27 | + |
| 28 | + [System.Diagnostics.DebuggerStepThroughAttribute()] |
| 29 | + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.1.0")] |
| 30 | + public partial class SecuredServiceClient : System.ServiceModel.ClientBase<ServiceReference1.ISecuredService>, ServiceReference1.ISecuredService |
| 31 | + { |
| 32 | + |
| 33 | + /// <summary> |
| 34 | + /// Implement this partial method to configure the service endpoint. |
| 35 | + /// </summary> |
| 36 | + /// <param name="serviceEndpoint">The endpoint to configure</param> |
| 37 | + /// <param name="clientCredentials">The client credentials</param> |
| 38 | + static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials); |
| 39 | + |
| 40 | + public SecuredServiceClient() : |
| 41 | + base(SecuredServiceClient.GetDefaultBinding(), SecuredServiceClient.GetDefaultEndpointAddress()) |
| 42 | + { |
| 43 | + this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_ISecuredService.ToString(); |
| 44 | + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); |
| 45 | + } |
| 46 | + |
| 47 | + public SecuredServiceClient(EndpointConfiguration endpointConfiguration) : |
| 48 | + base(SecuredServiceClient.GetBindingForEndpoint(endpointConfiguration), SecuredServiceClient.GetEndpointAddress(endpointConfiguration)) |
| 49 | + { |
| 50 | + this.Endpoint.Name = endpointConfiguration.ToString(); |
| 51 | + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); |
| 52 | + } |
| 53 | + |
| 54 | + public SecuredServiceClient(EndpointConfiguration endpointConfiguration, string remoteAddress) : |
| 55 | + base(SecuredServiceClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress)) |
| 56 | + { |
| 57 | + this.Endpoint.Name = endpointConfiguration.ToString(); |
| 58 | + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); |
| 59 | + } |
| 60 | + |
| 61 | + public SecuredServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : |
| 62 | + base(SecuredServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) |
| 63 | + { |
| 64 | + this.Endpoint.Name = endpointConfiguration.ToString(); |
| 65 | + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); |
| 66 | + } |
| 67 | + |
| 68 | + public SecuredServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : |
| 69 | + base(binding, remoteAddress) |
| 70 | + { |
| 71 | + } |
| 72 | + |
| 73 | + public System.Threading.Tasks.Task<string> EchoAsync(string value) |
| 74 | + { |
| 75 | + return base.Channel.EchoAsync(value); |
| 76 | + } |
| 77 | + |
| 78 | + public virtual System.Threading.Tasks.Task OpenAsync() |
| 79 | + { |
| 80 | + return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndOpen)); |
| 81 | + } |
| 82 | + |
| 83 | + private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration) |
| 84 | + { |
| 85 | + if ((endpointConfiguration == EndpointConfiguration.BasicHttpBinding_ISecuredService)) |
| 86 | + { |
| 87 | + System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding(); |
| 88 | + result.MaxBufferSize = int.MaxValue; |
| 89 | + result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max; |
| 90 | + result.MaxReceivedMessageSize = int.MaxValue; |
| 91 | + result.AllowCookies = true; |
| 92 | + result.Security.Mode = System.ServiceModel.BasicHttpSecurityMode.Transport; |
| 93 | + return result; |
| 94 | + } |
| 95 | + throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration)); |
| 96 | + } |
| 97 | + |
| 98 | + private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration) |
| 99 | + { |
| 100 | + if ((endpointConfiguration == EndpointConfiguration.BasicHttpBinding_ISecuredService)) |
| 101 | + { |
| 102 | + return new System.ServiceModel.EndpointAddress("https://localhost:7173/Service.svc"); |
| 103 | + } |
| 104 | + throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration)); |
| 105 | + } |
| 106 | + |
| 107 | + private static System.ServiceModel.Channels.Binding GetDefaultBinding() |
| 108 | + { |
| 109 | + return SecuredServiceClient.GetBindingForEndpoint(EndpointConfiguration.BasicHttpBinding_ISecuredService); |
| 110 | + } |
| 111 | + |
| 112 | + private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress() |
| 113 | + { |
| 114 | + return SecuredServiceClient.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_ISecuredService); |
| 115 | + } |
| 116 | + |
| 117 | + public enum EndpointConfiguration |
| 118 | + { |
| 119 | + |
| 120 | + BasicHttpBinding_ISecuredService, |
| 121 | + } |
| 122 | + } |
| 123 | +} |
0 commit comments