C# Класс MvcApi.Formatting.MediaTypeFormatter

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CanWriteType ( Type type ) : bool
ExecuteFormat ( Type type, object returnValue, FormatterContext formatterContext ) : void
GetPerRequestFormatterInstance ( Type type, HttpRequestMessage request, MediaTypeHeaderValue mediaType ) : MediaTypeFormatter

Returns a specialized instance of the MediaTypeFormatter that can handle formatting a response for the given parameters. This method is called by DefaultContentNegotiator after a formatter has been selected through content negotiation.

The default implementation returns this instance. Derived classes can choose to return a new instance if they need to close over any of the parameters.

SelectCharacterEncoding ( HttpRequestMessage contentHeaders ) : Encoding

Determines the best Encoding amongst the supported encodings for reading or writing an HTTP entity body based on the provided contentHeaders.

Приватные методы

Метод Описание
GetOrAddDelegatingType ( Type type ) : Type
GetResponseHeaders ( Type objectType, string mediaType, HttpResponseMessage responseMessage ) : string>>.IEnumerable
GetTypeRemappingConstructor ( Type type ) : ConstructorInfo
InitializeDefaultCollectionKeySize ( ) : int
MediaTypeFormatter ( ) : System
OnGetResponseHeaders ( Type objectType, string mediaType, HttpResponseMessage responseMessage ) : string>>.IEnumerable
TryGetDelegatingType ( Type interfaceType, Type &type ) : bool
TryGetDelegatingType1 ( Type interfaceType, Type &type ) : bool
TryGetDelegatingTypeForIEnumerableGenericOrSame ( Type &type ) : bool
TryGetDelegatingTypeForIQueryableGenericOrSame ( Type &type ) : bool
TryMatchMediaTypeMapping ( HttpRequestMessage request, MediaTypeFormatterMatch &mediaTypeMatch ) : bool
TryMatchMediaTypeMapping ( HttpResponseMessage response, MediaTypeFormatterMatch &mediaTypeMatch ) : bool

Описание методов

CanWriteType() публичный абстрактный Метод

public abstract CanWriteType ( Type type ) : bool
type System.Type
Результат bool

ExecuteFormat() публичный абстрактный Метод

public abstract ExecuteFormat ( Type type, object returnValue, FormatterContext formatterContext ) : void
type Type
returnValue object
formatterContext FormatterContext
Результат void

GetPerRequestFormatterInstance() публичный Метод

Returns a specialized instance of the MediaTypeFormatter that can handle formatting a response for the given parameters. This method is called by DefaultContentNegotiator after a formatter has been selected through content negotiation.
The default implementation returns this instance. Derived classes can choose to return a new instance if they need to close over any of the parameters.
public GetPerRequestFormatterInstance ( Type type, HttpRequestMessage request, MediaTypeHeaderValue mediaType ) : MediaTypeFormatter
type Type The type being serialized.
request HttpRequestMessage The request.
mediaType MediaTypeHeaderValue The media type chosen for the serialization. Can be null.
Результат MediaTypeFormatter

SelectCharacterEncoding() публичный Метод

Determines the best Encoding amongst the supported encodings for reading or writing an HTTP entity body based on the provided contentHeaders.
public SelectCharacterEncoding ( HttpRequestMessage contentHeaders ) : Encoding
contentHeaders HttpRequestMessage The content headers provided as part of the request or response.
Результат Encoding