-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runtime Aspect Loader feature #127
Comments
Hi! Thanks! var assembly = AspectLoader.Load(filename, loader => {
loader.Inject(typeof(LogAspect)).IntoMethod(m => m.Attributes == MethodAttributes.Public);
}); This might be useful if don't own target assembly. E.g. test loader or custom application loader/partcher. If you instead own target assembly you can use Propagate feature like this: [Aspect(Scope.Global)]
[Injection(typeof(LogAspect), Propagation = PropagateTo.Types | PropagateTo.Methods, PropagationFilter = "^MyMethod")]
public class LogAspect : Attribute
{
[Advice(Kind.Before, Targets = Target.Method | Target.Public)]
public void Log([Argument(Source.Name)] string method)
{
Console.WriteLine($"Entering {method}");
}
} And then apply it to assembly [assembly:LogAspect] Let me know if it works for you, and how would you like it work otherwise. Your usage scenarios would be plus) |
Thanks @pamidur. That makes sense. I will try it. |
@pamidur Is the AspectLoader or Propagation features already implemented? |
Hi @emisand , unfortunately AspectLoader is not ready (not even close to ready as there is some technical difficulties) |
Great job! It could be better if the Aspect attribute can add to the target automatically according to a config file.
The text was updated successfully, but these errors were encountered: