일부 일반 속성을 포함하는 일반 요청 메시지가있는 프로젝트 중 하나에 대해 ASP.NET WEB API를 작성 중입니다. DelegatingHandler를 빌드하고 싶습니다. 내부에서 IRequestMessage로 요청 (강력하게 형식화 된 모델)을 요청 (JSON 요청 또는 XML과 상관없이) 할 수 있고 일부 속성의 유효성을 검사 할 수 있습니다. 그것이 가능하고 그것을 어떻게 성취 할 수 있습니까?ASP NET 웹 API : 메시지 처리기 내에서 모델에 액세스하는 방법
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)
{
var response = await base.SendAsync(request, cancellationToken);
MyType type;
if (response.TryGetContentValue(out type))
{
// Yay! let's do something with this!
};
return response;
}
나는 내가 –