Consider the following IOperationBehavior attributes:
public class OperationCredentialsAttribute : Attribute, IOperationBehavior
{
}
public class OperationProcessesAttribute : Attribute, IOperationBehavior
{
}
... and the following operation definition:
public interface IService
{
[OperationCredentials(true)]
[OperationProcesses(new[] { "CreateCustomerProcess" })]
CreateCustomerResponse CreateCustomer(CreateCustomerMessage CreateCustomerMessage);
}
I need to make sure that the OperationCredentials attribute is processed before the OperationProcesses attribute since both are using the ApplyDispatchBehavior method to register custom invokers and the execution order is important.
From my tests the decoration order开发者_运维百科 is not always the order in what they are processed when the service loads.
Any ideas?
I think that your solution to merge the attributes into one was the correct one.
This article here discusses the precedence of the various extension mechanisms, and states that:
Within any collection of behaviors, again, no order is guaranteed.
Where a collection might be a set of IOperationBehaviors defined on a method.
精彩评论