Class StringResultWriter<TModel>
A result writer that simply writes a static string
Namespace: Seltzr.Results
Assembly: Seltzr.dll
Syntax
C#
public class StringResultWriter<TModel> : IResultWriter<TModel>, IResultWriter<TModel, object> where TModel : class
Type Parameters
TModel
The type of model managed by the API
Constructors
Initializes a new instance of the StringResultWriter<TModel> class.
C#
public StringResultWriter(string responseText)
Parameters
responseText
String
The text to respond with
Methods
Gets whether or not this IResultWriter<TModel, TUser> can write a result for the given request
C#
public virtual Task<bool> CanWriteAsync(HttpRequest request)
Parameters
request
HttpRequest
The request to test if a result can be written for it
Returns
true
|
Improve this Doc
View Source
WriteResultAsync(IApiContext<TModel, Object>, IEnumerable<TModel>, FormattingOptions)
Formats the API result
C#
public virtual Task WriteResultAsync(IApiContext<TModel, object> context, IEnumerable<TModel> data, FormattingOptions options)
Parameters
context
IApiContext<TModel, Object>
The current API context
data
IEnumerable<TModel>
The dataset to format
options
FormattingOptions
Options for formatting the result
Returns
When the result has been sent