Aspects.Logging.LogAttribute.CompileTimeValidate C# (CSharp) Method

CompileTimeValidate() public method

Method invoked at build time to ensure that the aspect has been applied to the right target.
public CompileTimeValidate ( MethodBase method ) : bool
method System.Reflection.MethodBase Method to which the aspect has been applied
return bool
        public override bool CompileTimeValidate(MethodBase method)
        {
            if (method == null) throw new ArgumentNullException("method");

            if (method.Name.Contains("ToString"))
                return false;
            if (typeof(ILogger).IsAssignableFrom(_declaringType))
                return false;
            if (typeof(IConfigurationProvider).IsAssignableFrom(_declaringType))
                return false;
            if (typeof(MessageFormatter).IsAssignableFrom(_declaringType))
                return false;
            if (method.DeclaringType == GetType())
                return false;
            if ((Excludes & Excludes.StaticConstructor) == Excludes.StaticConstructor && method.Name.StartsWith(".cctor", StringComparison.OrdinalIgnoreCase))
                return false;
            if ((Excludes & Excludes.InstanceConstructors) == Excludes.InstanceConstructors && method.Name.StartsWith(".ctor", StringComparison.OrdinalIgnoreCase))
                return false;
            if ((Excludes & Excludes.PropertyGetters) == Excludes.PropertyGetters && method.Name.StartsWith("get_", StringComparison.OrdinalIgnoreCase))
                return false;
            if ((Excludes & Excludes.PropertySetters) == Excludes.PropertySetters && method.Name.StartsWith("set_", StringComparison.OrdinalIgnoreCase))
                return false;
            return true;
        }