// Validate the attribute usage. public override bool CompileTimeValidate(MethodBase method) { if (method.IsConstructorInfo()) { Message.Write(MessageLocation.Of(method), SeverityType.Error, "CX0001", "Cannot cache constructors."); return false; } if (method.HasVoidReturn()) { Message.Write(MessageLocation.Of(method), SeverityType.Error, "CX0002", "Cannot cache void methods."); return false; } if (method.HasOutParameter()) { Message.Write(MessageLocation.Of(method), SeverityType.Error, "CX0003", "Cannot cache methods with \"out\" parameters"); return false; } if (!method.HasICacheContextParameter()) { Message.Write(MessageLocation.Of(method), SeverityType.Error, "CX0004", "Cannot cache methods without ICacheContext parameters."); return false; } return true; }