在我的示例代码中,我有以下内容:
namespace WebUx.Filters
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class InitializeSimpleMembershipAttribute : ActionFilterAttribute
{
private static SimpleMembershipInitializer _initializer;
private static object _initializerLock = new object();
private static bool _isInitialized;
public override void OnActionExecuting(ActionExecutingContext filterContext)
有人可以向我解释这是如何工作的吗?这会自动附加到每个类方法还是仅附加到控制器类?我同时使用 MVC 和 web api。它还会附加到 web api 方法吗?