OutputFormatterCanWriteContextExtensions Class
HAKOM.Serialization.Http.Net.Api.Extensions
Section titled “HAKOM.Serialization.Http.Net.Api.Extensions”Provides extension methods for Microsoft.AspNetCore.Mvc.Formatters.OutputFormatterCanWriteContext related to serializer resolution.
public static class OutputFormatterCanWriteContextExtensionsInheritance System.Object 🡒 OutputFormatterCanWriteContextExtensions
Methods
Section titled “Methods”OutputFormatterCanWriteContextExtensions.TrySetSerializer(this OutputFormatterCanWriteContext, Type) Method
Section titled “OutputFormatterCanWriteContextExtensions.TrySetSerializer(this OutputFormatterCanWriteContext, Type) Method”Attempts to resolve an ISerializer for the response based on the endpoint and request media types, and stores it in the HttpContext.
public static bool TrySetSerializer(this Microsoft.AspNetCore.Mvc.Formatters.OutputFormatterCanWriteContext context, System.Type? type=null);Parameters
Section titled “Parameters”context Microsoft.AspNetCore.Mvc.Formatters.OutputFormatterCanWriteContext
The Microsoft.AspNetCore.Mvc.Formatters.OutputFormatterCanWriteContext for the current response.
type System.Type
The type to serialize. If null, the type is inferred from the context.
Returns
Section titled “Returns”System.Boolean
true if a matching serializer was found and set; otherwise, false.
Was this page helpful?Thanks for your feedback!