public class AutoBindingFilter : IAsyncActionFilter, IOrderedFilter
{
public int Order => 2;
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
// 请求
var req = context.HttpContext.Request;
var args = context.ActionArguments;
if (args != null && args.Count() >= 1 &&
req.Method != "GET" && req.Method != "DELETE")
{
var isAdd = req.Method;
foreach (var item in args)
{
var currType = item.Value.GetType();
if (currType.IsArray)
{
//TODO:数组没有办法处理,需要获取 每一个对象的属性信息。。
var tt = JArray.Parse(item.Value.ToString());
var t1 = string.Empty;
}
}
}
}
}
Item.Value 怎么循环? 我需要获取 property 信息。
关键字 C# 反射