Skip to content
A Mono.Cecil based AoP rewriting tool for .Net
C#
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.nuget
Reweave.Core
Reweave
TestTargetApp
.gitignore
README.md
Reweave.sln

README.md

Reweave

A Mono.Cecil based assembly re-writer focused on enabling aspect oriented programming for .Net. This is an extremely early version - pre v0.1 to say the least.

With Reweave aspects are convention based, any Attribute with a name ending in "AspectAttribute" is considered an aspect - no run time library required. Likewise hooking into the method's execution is based on convention:

  • OnExecute - is called before the body of the method
    • methodName : string - the name of the method being invoked
    • className : string - the name of the class containing the method
    • arguments : Dictionary<string, object> - The name and value of each parameter passed to the method
    • return value : object - can optionally return a correlation value to be passed to the other methods of the aspect
  • OnComplete - is called before the method returns but after the body
    • methodName : string - the name of the method being invoked
    • className : string - the name of the class containing the method
    • arguments : Dictionary<string, object> - The name and value of each parameter passed to the method
    • returnValue : object - the value that will be returned from the method, null if the method has a void return
    • correlation : object - the value optionally returned from OnExecute
  • OnException - is called whenever an exception would bubble up from the method
    • methodName : string - the name of the method being invoked
    • className : string - the name of the class containing the method
    • arguments : Dictionary<string, object> - The name and value of each parameter passed to the method
    • correlation : object - the value optionally returned from OnExecute
    • exception : Exception - the exception that is bubbling up from the method

In addition aspects can either be static or instance by nature - if any of the above methods are defined as instance methods a new instance of the aspect will be created each time a method marked with it is invoked. Otherwise, if they are all static no instance will be created.

You can find the canonical logging example in TestTargetApp\LoggingAspectAttribute.cs.

So, if you are brave give it a go and let me know if it screws up on you.

Something went wrong with that request. Please try again.