public override bool CompileTimeValidate(LocationInfo locationInfo) { lock (this) { if (locationInfo.PropertyInfo == null) { PostSharpDescription.Add <SomeLocationAspect>( "(SomeLocationAspect) If you 'get' or 'set' me, I'll throw an exception. Good you knew, right? Applied on field: " + locationInfo.FieldInfo.AsSignature(), locationInfo.FieldInfo); } else { MethodInfo getMethod = locationInfo.PropertyInfo.GetGetMethod(true); MethodInfo setMethod = locationInfo.PropertyInfo.GetSetMethod(true); PostSharpDescription.Add <SomeLocationAspect>( "(SomeLocationAspect) If you 'get' or 'set' me, I'll throw an exception. Good you knew, right? Applied on property: " + locationInfo.PropertyInfo.AsSignature(), locationInfo.PropertyInfo); if (getMethod != null) { PostSharpDescription.Add <SomeLocationAspect>( "(SomeLocationAspect) If you 'get' me, I'll throw an exception. Good you knew, right? Applied on method '" + getMethod.Name + "'", locationInfo.PropertyInfo, getMethod); } if (setMethod != null) { PostSharpDescription.Add <SomeLocationAspect>( "(SomeLocationAspect) If you 'set' me, I'll throw an exception. Good you knew, right? Applied on method '" + setMethod.Name + "'", locationInfo.PropertyInfo, setMethod); } } return(base.CompileTimeValidate(locationInfo)); } }
public override bool CompileTimeValidate(MethodBase method) { PostSharpDescription.Add <SomeMethodAspect>("(SomeMethodAspect) Description applied on method '" + method.Name + "'", method); return(true); }
public override bool CompileTimeValidate(Type type) { this.Describe("(SomeTypeAspect) Applied on '" + type.AsSignature(true) + "'", type); PostSharpDescription.Add <SomeTypeAspect>("(SomeTypeAspect) All your base types are belong to us", type); PostSharpDescription.Add <SomeTypeAspect>("(SomeTypeAspect) Last compile time: " + DateTime.Now, type); return(base.CompileTimeValidate(type)); }