Class AcceptDependentResultWriter<TModel, TUser>
A RequestDependentResultWriter<TModel, TUser> that uses the Accept header to determine which result writer to use
Implements
IResultWriter<TModel, TUser>
Namespace: Seltzr.Results
Assembly: Seltzr.dll
Syntax
C#
public class AcceptDependentResultWriter<TModel, TUser> : RequestDependentResultWriter<TModel, TUser>, IResultWriter<TModel, TUser> where TModel : class where TUser : class
Type Parameters
TModel
The type of model to format
TUser
The type of user context
Constructors
|
Improve this Doc
View Source
AcceptDependentResultWriter(String[], IResultWriter<TModel, TUser>[], Int32)
Initializes a new instance of the AcceptDependentResultWriter<TModel, TUser> class.
C#
public AcceptDependentResultWriter(string[] mimeTypes, IResultWriter<TModel, TUser>[] writers, int defaultIndex = -1)
Parameters
mimeTypes
String[]
The mime types that should determine which result writer to use
writers
IResultWriter<TModel, TUser>[]
The result writers to use, indexed in the same order as mimeTypes
defaultIndex
Int32
The index of the default result writer to use, or -1 if an error should be thrown if no values match
Methods
Gets the first usable mime-type in the Accept header
C#
protected override string GetRequestParameterValue(HttpRequest request)
Parameters
request
HttpRequest
The request context to use to get the value
Returns
The mime-type to use to write a result
Overrides
Seltzr.Results.RequestDependentResultWriter<TModel, TUser>.GetRequestParameterValue(Microsoft.AspNetCore.Http.HttpRequest)