There will be cases where you want a single interceptor action to handle more than one property but less than an entire class. In this case, it may be useful to write an interceptor action similar to the following:
C# | [BeforeSet(EntityPropertyNames.FirstName)] [BeforeSet(EntityPropertyNames.LastName)] public void UppercaseName( IbCore.PropertyInterceptorArgs<Employee, String> args) { var name = args.Value; if (!String.IsNullOrEmpty(name)) { args.Value = args.Value.ToUpper(); } } |
VB | <BeforeSet(EntityPropertyNames.FirstName), BeforeSet(EntityPropertyNames.LastName)> _ Public Sub UppercaseName(ByVal args As _ PropertyInterceptorArgs(Of Employee, String)) Dim name = args.Value If Not String.IsNullOrEmpty(name) Then args.Value = args.Value.ToUpper() End If End Sub |