有什么方法可以在带有C#的WebAPI中使用泛型的端点?

问题描述 投票:0回答:1

具有.net核心和牛顿JSON。我可以使用通用端点吗?我应该如何要求它传递通用类型?

public async Task<JsonResult> SaveSetting<T>([FromBody] Filter<T> model)
{}

public class Filter<T>
{
    public string GUID { get; set; }

    public string Name { get; set; }

    public FilterType FilterType { get; set; }

    public T FilterRequestModel { get; set; }
}
c# .net asp.net-core asp.net-web-api json.net
1个回答
1
投票

如果有办法的话,不太可能有easy

© www.soinside.com 2019 - 2024. All rights reserved.