This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
/
ResultExecutingContext.cs
48 lines (43 loc) · 1.98 KB
/
ResultExecutingContext.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A context for result filters, specifically <see cref="IResultFilter.OnResultExecuting"/> and
/// <see cref="IAsyncResultFilter.OnResultExecutionAsync"/> calls.
/// </summary>
public class ResultExecutingContext : FilterContext
{
/// <summary>
/// Instantiates a new <see cref="ResultExecutingContext"/> instance.
/// </summary>
/// <param name="actionContext">The <see cref="ActionContext"/>.</param>
/// <param name="filters">All applicable <see cref="IFilterMetadata"/> implementations.</param>
/// <param name="result">The <see cref="IActionResult"/> of the action and action filters.</param>
/// <param name="controller">The controller instance containing the action.</param>
public ResultExecutingContext(
ActionContext actionContext,
IList<IFilterMetadata> filters,
IActionResult result,
object controller)
: base(actionContext, filters)
{
Result = result;
Controller = controller;
}
/// <summary>
/// Gets the controller instance containing the action.
/// </summary>
public virtual object Controller { get; }
/// <summary>
/// Gets or sets the <see cref="IActionResult"/> to execute. Setting <see cref="Result"/> to a non-<c>null</c>
/// value inside a result filter will short-circuit the result and any remaining result filters.
/// </summary>
public virtual IActionResult Result { get; set; }
/// <summary>
/// Gets or sets an indication the result filter pipeline should be short-circuited.
/// </summary>
public virtual bool Cancel { get; set; }
}
}