WebOperationContext 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
웹 요청 및 응답의 컨텍스트 속성에 쉽게 액세스할 수 있는 도우미 클래스입니다.
public ref class WebOperationContext : System::ServiceModel::IExtension<System::ServiceModel::OperationContext ^>
public class WebOperationContext : System.ServiceModel.IExtension<System.ServiceModel.OperationContext>
type WebOperationContext = class
interface IExtension<OperationContext>
Public Class WebOperationContext
Implements IExtension(Of OperationContext)
- 상속
-
WebOperationContext
- 구현
예제
다음 코드는 현재 호출의 UriTemplateMatch 웹 작업 컨텍스트와 연결된 인스턴스를 검색하는 방법을 보여 줍니다. 또한 이 코드는 나가는 응답에 대한 HTTP 상태를 설정하는 방법을 보여 줍니다.
counter++;
UriTemplateMatch match = WebOperationContext.Current.IncomingRequest.UriTemplateMatch;
UriTemplate template = new UriTemplate("{id}");
customer.Uri = template.BindByPosition(match.BaseUri, counter.ToString());
customers[counter.ToString()] = customer;
WebOperationContext.Current.OutgoingResponse.SetStatusAsCreated(customer.Uri);
counter = counter + 1
Dim match As UriTemplateMatch = WebOperationContext.Current.IncomingRequest.UriTemplateMatch
Dim template As New UriTemplate("{id}")
customer.Uri = template.BindByPosition(match.BaseUri, counter.ToString())
customers(counter.ToString()) = customer
WebOperationContext.Current.OutgoingResponse.SetStatusAsCreated(customer.Uri)
생성자
| Name | Description |
|---|---|
| WebOperationContext(OperationContext) |
지정된 WebOperationContext 인스턴스를 사용하여 클래스의 OperationContext 새 인스턴스를 초기화합니다. |
속성
| Name | Description |
|---|---|
| Current |
현재 웹 작업 컨텍스트를 가져옵니다. |
| IncomingRequest |
수신되는 요청에 대한 웹 요청 컨텍스트를 가져옵니다. |
| IncomingResponse |
수신되는 요청에 대한 웹 응답 컨텍스트를 가져옵니다. |
| OutgoingRequest |
전송되는 요청에 대한 웹 요청 컨텍스트를 가져옵니다. |
| OutgoingResponse |
전송되는 응답에 대한 웹 응답 컨텍스트를 가져옵니다. |