Thanks to visit codestin.com
Credit goes to github.com

Skip to content

EventInvokerSelectionInjection

Charles Grunwald edited this page Jun 11, 2014 · 3 revisions

Introduction

Event invoker is the method that actually fires the PropertyChanging event. Although it is not part of the INotifyPropertyChanging interface the standard form is as follows

public virtual void OnPropertyChanging(string propertyName)
{
    var propertyChanging = PropertyChanging;
    if (propertyChanging != null)
    {
        propertyChanging(this, new PropertyChangingEventArgs(propertyName));
    }
}

Event Invoker Name

The name of the event invoker method can be changed (from its default of OnPropertyChanging) using the EventInvokerName property of the WeavingTask.

For example you could use

<Weavers>
  <PropertyChanging EventInvokerNames="RaisePropertyChanging"/>
</Weavers>

So in all examples you can exchange OnPropertyChanging with whatever you have selected using EventInvokerNames.

Method Selection / Injection

The event invoker call is done as follows

  • Try to find a method with the following signature in the class hierarchy (where method name matches EventInvokerNames) OnPropertyChanging(string propertyName)
  • If no method is found then the standard OnPropertyChanging code (listed above) is injected.

Clone this wiki locally