I have 3 attributes I am using for my Inteception pipeline in Unity v2.1. Everything is firing off properly they are just in the wrong order.
In all 3 Attributes I have made sure I am passing the corresponding Handler the Order from the attribute.
So if I call the setter on the TestClass.TestProperty below I am expecting that the call handlers should be called in this order: Validation, Transaction, Notify. What I am seeing is Notify, Transaction, Validation.
I have 2 questions here that I can't find answers to using googling around.
- In my example of setting the TestClass.TestProperty is it suppose to call the property attributes first then the class ones? Or should Unity respect my Order?
If the 2 property handlers are called first should I not see Notify, Transaction. If I override the Transaction and Notify Order defaults to 1 and 2 respectively I get Transaction, Notify as expected. Should it matter that my order start at 1.
[AttributeUsage(AttributeTargets.Class) public class ValidationAttribute : HandlerAttribute { public ValidationAttribute(int order = 1) { Order = order } public override ICallHandler CreateHandler(IUnityContainer container) { var ValidationHandler = container.Resolve<ValidationHandler>(); ValidationHandler.Order = Order; } } public class TransactionAttribute : HandlerAttribute { public TransactionAttribute (int order = 2) { Order = order } // Same CreateHandler as above resolving correct handler } public class NotifyAttribute : HandlerAttribute { public NotifyAttribute (int order = 3) { Order = order } // Same CreateHandler as above resolving correct handler } // Didn't include handler code to keep short(ish). All handlers have logging to show they are executing ... [Validation] public class TestClass { public int TestProperty { get; [Transaction] [Notify] set; } }