Marks an action to be performed in a property setter after the value is written to the backing store.
Syntax
Example
C# | Copy Code |
---|
public partial class Customer {
// Sample signatures for a AfterSet method for any Customer property
// (invoked for both simple and navigation properties).
// Additional signatures are possible.
// Although you can change args.Value in an AfterSet method, the backing store
// is not modified, but the modified value will be passed to subsequent AfterSet actions.
// Setting args.Cancel in an AfterSet also does not affect the backing store,
// but does stop subsequent actions from being executed.
// Signature 1 - accept a property value and return a property value.
// Any value returned is passed to next action but does not affect the
// backing store.
[AfterSet]
public object AfterSetAnyCustomerProperty1(object value) {
Console.WriteLine("After setting a customer property 1");
return value;
}
// Signature 2 - accept a property value, but no return value.
[AfterSet]
public void AfterSetAnyCustomerProperty2(object value) {
Console.WriteLine("After setting a customer property 2");
}
// Signature 3 - accept base IPropertyInterceptorArgs.
// Allows you to cancel further actions and modify the Value.
// No property information available.
[AfterSet]
public void AfterSetAnyCustomerProperty3(IPropertyInterceptorArgs args) {
Console.WriteLine("After setting a customer property 3");
}
// Signature 4 - accept EntityProperty interceptor arguments.
// The arguments passed allow you to determine the property retrieved
// and to cancel further actions.
[AfterSet]
public void AfterSetAnyCustomerProperty4(IEntityPropertySetInterceptorArgs args) {
Console.WriteLine("After setting a customer property 4");
}
// Signature 5 - accept strongly-typed IPropertyInterceptorArgs.
// Same features as IPropertyInterceptorArgs but Instance is now strongly-typed.
[AfterSet]
public void AfterSetAnyCustomerProperty5(IPropertyInterceptorArgs<Customer, object> args) {
Console.WriteLine("After setting 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