我可以将接口实例传递给.net Core中的属性吗?

时间:2019-12-18 16:19:25

标签: asp.net-web-api .net-core attributes asp.net-core-webapi-2.1

**public class HMACAuthenticationAttribute : Attribute, IAsyncAuthorizationFilter
{
   public HMACAuthenticationAttribute(IUser user)  
   {
     .....
   }
}**

上面是我的类属性。我想在下面的控制器中调用它。有什么方法可以调用上面的类。

**[HMACAuthentication()]
public class WeatherForecastController : ControllerBase
{
}**

0 个答案:

没有答案