IdeaBlade DevForce 2010 Help Reference
TargetType Property
See Also  Example Send Feedback
IdeaBlade.Core Assembly > IdeaBlade.Core Namespace > PropertyInterceptorAttribute Class : TargetType Property



The Type of the object for which the property interceptor is defined.

Syntax

Visual Basic (Declaration) 
Public Property TargetType As Type
Visual Basic (Usage)Copy Code
Dim instance As PropertyInterceptorAttribute
Dim value As Type
 
instance.TargetType = value
 
value = instance.TargetType
C# 
public Type TargetType {get; set;}
C++/CLI 
public:
property Type^ TargetType {
   Type^ get();
   void set (    Type^ value);
}

Example

C#Copy Code
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));

Remarks

Applies to the Type and its sub-types.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.