有没有办法在ASP.NET Web API中全局设置ODataValidationSettings的属性?
我希望为所有控制器更改MaxNodeCount,并在全局OData配置期间寻找一种方法:
public static void Register(HttpConfiguration config)
{
var builder = new ODataConventionModelBuilder();
config.MapODataServiceRoute("odata", "odata", builder.GetEdmModel());
config
.Select()
.Expand()
.Filter()
.OrderBy()
.MaxTop(null)
.Count()
// Looking for something like this:
.MaxNodeCount(20)
// Or like this:
.SetDefaultODataValidationSettings(new ODataValidationSettings {MaxNodeCount = 20});
}