Marks an action to be performed in a property getter after the value is retrieved from the backing store.
Syntax
Example
C# | Copy Code |
---|
public partial class Customer {
// Sample signatures for a AfterGet method for any Customer property
// (both simple and navigation properties).
// Additional signatures are possible.
// Signature 1 - accept a property value and return a property value.
// Any value returned is passed to the next interceptor.
[AfterGet]
public object AfterGetAnyCustomerProperty1(object value) {
Console.WriteLine("AfterGet on a customer property 1");
return value;
}
// Signature 2 - accept a property value, but no return value.
[AfterGet]
public void AfterGetAnyCustomerProperty2(object value) {
Console.WriteLine("AfterGet on a customer property 2");
}
// Signature 3 - accept base IPropertyInterceptorArgs.
// Allows you to cancel further actions and modify the Value.
// No property information available.
[AfterGet]
public void AfterGetAnyCustomerProperty3(IPropertyInterceptorArgs args) {
Console.WriteLine("AfterGet on a customer property 3");
}
// Signature 4 - accept EntityProperty interceptor arguments.
// The arguments passed allow you to determine the property retrieved
// and to to cancel further actions and modify the Value.
[AfterGet]
public void AfterGetAnyCustomerProperty4(IEntityPropertyGetInterceptorArgs args) {
Console.WriteLine("Got customer property " + args.EntityProperty.Name);
}
// Signature 5 - accept strongly-typed IPropertyInterceptorArgs.
// Same features as IPropertyInterceptorArgs but Instance is now strongly-typed.
[AfterGet]
public void AfterGetAnyCustomerProperty5(IPropertyInterceptorArgs<Customer, object> args) {
Customer c = args.Instance;
Console.WriteLine("AfterGet on a customer property 5");
}
} |
Remarks
Inheritance Hierarchy
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