📜  .net 返回 context.Result 没有额外的新 objectResult - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:53.854000             🧑  作者: Mango

代码示例2
public class ErrorModel
{
    public string Error { get; set; }

    public int Id { get; set; }

    public List Values { get; set; }
}

//filter

var error = new ErrorModel
{
    Error = context.Exception.Message,
    Id = 1,
    Values = new List { 1, 2, 3 }
};
context.Result = new ObjectResult(error)
{
    StatusCode = 500
};