我正在IActionFilter中更改响应对象中的某些字段:
public async void OnActionExecuted(ActionExecutedContext context)
{
ObjectResult actionResult = (ObjectResult)context.Result;
IHavePrice havePrice = Cast<IHavePrice>(actionResult.Value);
var items = await _priceSetter.GetPrices<IHavePrice>(username, new List<IHavePrice>() { havePrice });
havePrice = items[0];
}
代码有效:我可以看到context.Result.Value中的更改。但是在前端,我在响应对象中收到旧值。