ClientBase<TChannel> 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
서비스를 호출할 수 있는 WCF(Windows Communication Foundation) 클라이언트 개체를 만들 때 사용되는 기본 구현을 제공합니다.
generic <typename TChannel>
where TChannel : classpublic ref class ClientBase abstract : System::ServiceModel::ICommunicationObject
generic <typename TChannel>
where TChannel : classpublic ref class ClientBase abstract : IAsyncDisposable, IDisposable, System::ServiceModel::ICommunicationObject
generic <typename TChannel>
where TChannel : classpublic ref class ClientBase abstract : IDisposable, System::ServiceModel::ICommunicationObject
public abstract class ClientBase<TChannel> : System.ServiceModel.ICommunicationObject where TChannel : class
public abstract class ClientBase<TChannel> : IAsyncDisposable, IDisposable, System.ServiceModel.ICommunicationObject where TChannel : class
public abstract class ClientBase<TChannel> : IDisposable, System.ServiceModel.ICommunicationObject where TChannel : class
type ClientBase<'Channel (requires 'Channel : null)> = class
interface ICommunicationObject
type ClientBase<'Channel (requires 'Channel : null)> = class
interface ICommunicationObject
interface IDisposable
interface IAsyncDisposable
type ClientBase<'Channel (requires 'Channel : null)> = class
interface ICommunicationObject
interface IDisposable
Public MustInherit Class ClientBase(Of TChannel)
Implements ICommunicationObject
Public MustInherit Class ClientBase(Of TChannel)
Implements IAsyncDisposable, ICommunicationObject, IDisposable
Public MustInherit Class ClientBase(Of TChannel)
Implements ICommunicationObject, IDisposable
형식 매개 변수
- TChannel
서비스에 연결할 때 사용할 채널입니다.
- 상속
-
ClientBase<TChannel>
- 파생
- 구현
예제
다음 코드 예제에서는 ServiceModel 메타데이터 유틸리티 도구(Svcutil.exe) 가 클래스를 ClientBase<TChannel> 확장하여 WCF 클라이언트 클래스를 만드는 방법을 보여 줍니다.
public partial class SampleServiceClient : System.ServiceModel.ClientBase<ISampleService>, ISampleService
{
public SampleServiceClient()
{
}
public SampleServiceClient(string endpointConfigurationName) :
base(endpointConfigurationName)
{
}
public SampleServiceClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public SampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
public string SampleMethod(string msg)
{
return base.Channel.SampleMethod(msg);
}
}
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")> _
Partial Public Class SampleServiceClient
Inherits System.ServiceModel.ClientBase(Of ISampleService)
Implements ISampleService
Public Sub New()
End Sub
Public Sub New(ByVal endpointConfigurationName As String)
MyBase.New(endpointConfigurationName)
End Sub
Public Sub New(ByVal endpointConfigurationName As String, ByVal remoteAddress As String)
MyBase.New(endpointConfigurationName, remoteAddress)
End Sub
Public Sub New(ByVal endpointConfigurationName As String, _
ByVal remoteAddress As System.ServiceModel.EndpointAddress)
MyBase.New(endpointConfigurationName, remoteAddress)
End Sub
Public Sub New(ByVal binding As System.ServiceModel.Channels.Binding, _
ByVal remoteAddress As System.ServiceModel.EndpointAddress)
MyBase.New(binding, remoteAddress)
End Sub
Public Function SampleMethod(ByVal msg As String) As String Implements ISampleService.SampleMethod
Return MyBase.Channel.SampleMethod(msg)
End Function
End Class
설명
클래스를 ClientBase<TChannel> 확장하여 서비스에 연결하는 데 사용할 수 있는 사용자 지정 WCF 클라이언트 개체를 만듭니다. 일반적으로 WCF 클라이언트 기본 클래스는 사용자를 대신하여 ServiceModel 메타데이터 유틸리티 도구(Svcutil.exe) 와 같은 도구에 의해 확장됩니다. 예제에 대해서는 예제 섹션을 참조하세요.
클래스는 ClientBase<TChannel> 인터페이스 및 클래스를 사용하기 위해 개체를 선호하는 개발자가 빠르고 쉽게 사용할 수 있습니다 System.ServiceModel.ChannelFactory<TChannel> . 모든 경우에 이 클래스는 클래스와 인터페이스의 System.ServiceModel.ChannelFactory<TChannel> 메서드와 기능을 래핑하거나 노출합니다 System.ServiceModel.IClientChannel .
System.ServiceModel.ServiceHost 클래스를 사용할 때와 마찬가지로, 임의의 호출을 수행하거나 Open을 호출하기 전에 클래스를 만들고 엔드포인트, 채널 팩터리 또는 보안 정보를 수정할 수 있습니다. 자세한 내용은 WCF 클라이언트 개요 및 WCF 클라이언트를 사용하여 서비스에 액세스를 참조하세요.
이 클래스에서 파생된 Managed C++ 사용자 관련 참고 사항:
소멸자가 아닌 (켜기)(시작)닫기(및/또는 OnAbort)에 정리 코드를 넣습니다.
소멸자 방지: 컴파일러에서 를 자동으로 생성 IDisposable합니다.
참조가 아닌 멤버 방지: 컴파일러에서 를 자동으로 생성 IDisposable할 수 있습니다.
종료자 방지; 그러나 하나를 포함하는 경우 빌드 경고를 표시하지 않고 (켜기)(시작)닫기(및/또는 OnAbort)에서 종료자 자체를 호출 SuppressFinalize(Object) 하여 자동 생성된 IDisposable 동작을 에뮬레이트해야 합니다.
생성자
속성
CacheSetting |
캐시 설정을 가져오거나 설정합니다. |
Channel |
다양하게 구성된 서비스 엔드포인트로 메시지를 보내는 데 사용되는 내부 채널을 가져옵니다. |
ChannelFactory |
내부 ChannelFactory<TChannel> 개체를 가져옵니다. |
ClientCredentials |
작업 호출에 사용되는 클라이언트 자격 증명을 가져옵니다. |
Endpoint |
WCF 클라이언트가 연결할 수 있는 서비스의 대상 엔드포인트를 가져옵니다. |
InnerChannel |
내부 IClientChannel 구현을 가져옵니다. |
State |
ClientBase<TChannel> 개체의 현재 상태를 가져옵니다. |
메서드
Abort() |
ClientBase<TChannel> 개체가 즉시 현재 상태에서 Closed 상태로 전환되도록 합니다. |
Close() |
ClientBase<TChannel> 개체가 현재 상태에서 Closed 상태로 전환되도록 합니다. |
CloseAsync() |
서비스를 호출할 수 있는 WCF(Windows Communication Foundation) 클라이언트 개체를 만들 때 사용되는 기본 구현을 제공합니다. |
CreateChannel() |
서비스에 대한 새 채널을 반환합니다. |
DisplayInitializationUI() |
채널을 초기화하는 데 사용자 인터페이스가 필요한 경우 채널을 사용하기 전에 내부 채널이 사용자 인터페이스를 표시하도록 합니다. |
Equals(Object) |
지정된 개체가 현재 개체와 같은지 확인합니다. (다음에서 상속됨 Object) |
GetDefaultValueForInitialization<T>() |
C#에서 기본 키워드의 동작을 복제합니다. |
GetHashCode() |
기본 해시 함수로 작동합니다. (다음에서 상속됨 Object) |
GetType() |
현재 인스턴스의 Type을 가져옵니다. (다음에서 상속됨 Object) |
InvokeAsync(ClientBase<TChannel>.BeginOperationDelegate, Object[], ClientBase<TChannel>.EndOperationDelegate, SendOrPostCallback, Object) |
이벤트 기반 비동기 패턴을 구현하도록 지원합니다. 이 패턴에 대한 자세한 내용은 이벤트 기반 비동기 패턴 개요를 참조하세요. |
MemberwiseClone() |
현재 Object의 단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
Open() |
ClientBase<TChannel> 개체가 Created 상태에서 Opened 상태로 전환되도록 합니다. |
OpenAsync() |
서비스를 호출할 수 있는 WCF(Windows Communication Foundation) 클라이언트 개체를 만들 때 사용되는 기본 구현을 제공합니다. |
ToString() |
현재 개체를 나타내는 문자열을 반환합니다. (다음에서 상속됨 Object) |
명시적 인터페이스 구현
확장 메서드
CloseHelperAsync(ICommunicationObject, TimeSpan) |
서비스를 호출할 수 있는 WCF(Windows Communication Foundation) 클라이언트 개체를 만들 때 사용되는 기본 구현을 제공합니다. |
OpenHelperAsync(ICommunicationObject, TimeSpan) |
서비스를 호출할 수 있는 WCF(Windows Communication Foundation) 클라이언트 개체를 만들 때 사용되는 기본 구현을 제공합니다. |
ConfigureAwait(IAsyncDisposable, Boolean) |
비동기 일회용에서 반환되는 작업을 대기하는 방법을 구성합니다. |
적용 대상
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기