【发布时间】:2020-06-12 05:53:31
【问题描述】:
如何在 ActionFilterAttribute 中获取实际对象的值? 在调试器中,我看到 actionExecutedContext.Result.Value 中的值。
但是,当尝试将它们实际输入为时
actionExecutedContext.Result.Value 或actionExecutedContext.Result.GetValue(),它无法识别它们。
我需要实际对象,因此可以将其发送到我的静态数据方法之一,该方法接受输入并将所有数字乘以 2。
public async Task OnActionExecutionAsync(ActionExecutingContext actionContext, ActionExecutionDelegate next)
{
var actionExecutedContext= await next();
// ObjectDataConverter.MultiplyIntegersBy2(test.Result.Value);
}
actionExecutedContext.Result.Value 错误 CS1061:“IActionResult”不包含“Value”的定义,并且找不到接受“IActionResult”类型的第一个参数的可访问扩展方法“Value”(您是否缺少 using 指令还是程序集参考?)
【问题讨论】:
标签: c# .net asp.net-core .net-core action-filter