DevForce Help Reference
GetActions(PropertyInterceptorTiming,Type) Method
Example 


Retrieve all actions for the specified type and mode.
Syntax
'Declaration
 
Public Overloads Function GetActions( _
   ByVal timing As PropertyInterceptorTiming, _
   ByVal targetType As Type _
) As IEnumerable(Of PropertyInterceptorAction(Of TArgs))
'Usage
 
Dim instance As PropertyInterceptor(Of TInstance,TValue,TArgs)
Dim timing As PropertyInterceptorTiming
Dim targetType As Type
Dim value As IEnumerable(Of PropertyInterceptorAction(Of TArgs))
 
value = instance.GetActions(timing, targetType)

Parameters

timing
targetType
Remarks
The targetType parameter value may be a subtype of TargetType. Skipped keys are not included in the return list.
Example
public void Sample() {

    DomainModelEntityManager mgr = DomainModelEntityManager.DefaultManager;
    Customer c1 = mgr.Customers.First();

    // Look at all before set actions affecting customer company name
    foreach (var action in Customer.CompanyNameEntityProperty.SetterInterceptor.GetActions(PropertyInterceptorTiming.Before, typeof(Customer))) {
      Console.WriteLine(action.Key + " = " + action.Order);
    }

    // Skip an action
    Customer.CompanyNameEntityProperty.SetterInterceptor.AddSkipKey("A");

    // Set property - output window will show which actions were performed.
    c1.CompanyName = "Boxes n Things";

    // Now include the skipped action.
    Customer.CompanyNameEntityProperty.SetterInterceptor.RemoveSkipKey("A");

    // Set property - we should see all actions invoked.
    c1.CompanyName = "Boxes n Stuff";
  }
  
public partial class Customer {

  [BeforeSet(Key = "A")]
  public void BeforeSetAnyCustomerProperty(IEntityPropertySetInterceptorArgs args) {
    Console.WriteLine("Customer any - before setting " + args.EntityProperty.Name);
  }

  [BeforeSet("CompanyName", Key = "B")]
  public void BeforeSetCompanyName(IEntityPropertySetInterceptorArgs args) {
    Console.WriteLine("Customer companyname - before setting company name");
  }
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

PropertyInterceptor<TInstance,TValue,TArgs> Class
PropertyInterceptor<TInstance,TValue,TArgs> Members
Overload List

Send Feedback