I am decorating class methods with a custom TriggerHandler
attribute.
public class TriggerHandlerAttribute : Attribute
{
#region Data Members
public readonly Type EntityType;
public readonly TriggerType TriggerType;
#endregion
#region Constructor
public TriggerHandlerAttribute( Type entityType, TriggerType eventType )
{
EntityType = entityType;
EventType = eventType;
}
#endregion
}
[TriggerHandler(typeof(SomeType), TriggerType.Basic)]
private void SomeMethod( ITriggerBasic<SomeType> triggerContext )
{
...
}
I would like to be able to define a parameter-less constructor for this attribute and use reflection to fill in the fields, but to do this, I need to be able to access the MethodInfo
of the method that is decorated with this attribute.
Is there a way to obtain the MethodInfo
of the method that the particular TriggerHandlerAttribute
is assigned to? If so, how can I accomplish this?
Aucun commentaire:
Enregistrer un commentaire