有什么方法可以使用apiController的Validate方法吗?

时间:2020-08-29 07:36:52

标签: c# class annotations

1 个答案:

答案 0 :(得分:0)

如果您要向控制器继承ApiController类,则可以使用this运算符

对其进行调用

例如,

using System;
using System.Web.Http;
...
public class SampleController : ApiController
{

   public IActionResult GetSample()
   {
       //Your code goes here
       this.Validate();  //This is the way to call Validate method
   }
}