Skip to content

jauntus/MethodDecorator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chat on Gitter NuGet Status

Icon

The nuget package

https://nuget.org/packages/MethodDecorator.Fody.PP/

PM> Install-Package MethodDecorator.Fody.PP

This is an add-in for Fody

Compile time decorator pattern via IL rewriting

Introduction to Fody

Changes from origin

* A few bugs fixed
* Support for an attribute parameters and fields (attribute instantiation procedure now use GetCustomAtributes)
* OnExit now receiving return value of a method (optional)
* AspectPriority to alter decoration order for different attribute types
* Partial decoration to improve performance - any single method of an interceptor can be defined (requires IAspectMatchingRule implementation)
* Ability to skip actual execution of an intercepted method and substitute the return value (NeedBypass/AlterRetval)

List of possible decoration points

namespace MethodDecorator.Fody.Interfaces
{
    public interface IPartialDecoratorInit1
    {
        void Init(MethodBase iMethod);
    }
    public interface IPartialDecoratorInit2
    {
        void Init(object iInstance,MethodBase iMethod);
    }
    public interface IPartialDecoratorInit3
    {
        void Init(object iInstance, MethodBase iMethod, object[] iParameters);
    }
    public interface IPartialDecoratorEntry
    {
        void OnEntry();
    }
    public interface IPartialDecoratorExit
    {
        void OnExit();
    }
    public interface IPartialDecoratorExit1
    {
        void OnExit(object iRetval);
    }
    public interface IPartialDecoratorException
    {
        void OnException(Exception iException);
    }
    interface IPartialDecoratorContinuation
    {
        void OnTaskContinuation(Task task);
    }
    interface IPartialDecoratorNeedBypass
    {
        bool NeedBypass();
    }
    interface IPartialAlterRetval
    {
        object AlterRetval(object iRetval);
    }
}

### Recent changes
	
	[0.9.1.6] Fixed some PEVerify unjust complains
	[0.9.1.5] Copied MethodDecoratorInterfaces.dll into Lib folder - to be added into project references when installing the package	

About

Compile time decorator pattern via IL rewriting

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 97.9%
  • PowerShell 2.1%