DevForce Help Reference
TargetType Property (PropertyInterceptorAttribute)
Example 


The Type of the object for which the property interceptor is defined.
Syntax
'Declaration
 
Public Property TargetType As Type
'Usage
 
Dim instance As PropertyInterceptorAttribute
Dim value As Type
 
instance.TargetType = value
 
value = instance.TargetType
public Type TargetType {get; set;}
Remarks
Applies to the Type and its sub-types.
Example
public class EmployeeInterceptorExtensions {

  // A sample BeforeSet attribute defined on a static method which is not
  // in the TargetType class.  Here, both TargetName and TargetType
  // are specified.  
  
  [BeforeSet( Employee.EntityPropertyNames.Country, TargetType=typeof(Employee))]
  public static void UpperCaseCountry(IPropertyInterceptorArgs<Employee, String> args) {
    string country = args.Value;
    if (!String.IsNullOrEmpty(country)) {
      args.Value = country.ToUpper();
    }
  }
}
    
// Attributes which are not defined on the TargetType class
// will not be automatically discovered, so we also need to force the discovery:
PropertyInterceptorManager.CurrentInstance.DiscoverInterceptorsFromAttributes(typeof(EmployeeInterceptorExtensions));
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

PropertyInterceptorAttribute Class
PropertyInterceptorAttribute Members

Send Feedback