Interface IInvocationContext
Contains the related context of a perticular method invocation
Namespace: Solti.Utils.DI.Interfaces
Assembly: Solti.Utils.DI.Interfaces.dll
Syntax
public interface IInvocationContext
Remarks
This context is used during interface interception in Invoke(IInvocationContext, CallNextDelegate<IInvocationContext, Object>) method.
Properties
Args
The arguments passed by the caller.
Declaration
object[] Args { get; }
Property Value
Type | Description |
---|---|
System.Object[] |
Remarks
You can modify input arguments by changening the corrensponing value in this array before dispatching the invocation:
object IInterfaceInterceptor.Invoke(IInvocationContext context, Next<object> callNext)
{
context.Args[0] = "cica";
return callNext();
}
InterfaceMember
The member (property, event or method) that is being invoked.
Declaration
MemberInfo InterfaceMember { get; }
Property Value
Type | Description |
---|---|
System.Reflection.MemberInfo |
InterfaceMethod
The concrete method behind the InterfaceMember.
Declaration
MethodInfo InterfaceMethod { get; }
Property Value
Type | Description |
---|---|
System.Reflection.MethodInfo |
Next
Context belonging to the next interceptor.
Declaration
IInvocationContext Next { get; }
Property Value
Type | Description |
---|---|
IInvocationContext |
ProxyInstance
The underlying proxy instance. It's safe to cast it to the actual interface.
Declaration
object ProxyInstance { get; }
Property Value
Type | Description |
---|---|
System.Object |
Remarks
This property is useful when you want to invoke interface members involving their interceptors too:
object IInterfaceInterceptor.Invoke(IInvocationContext context, Next<object> callNext)
{
((IMyService) context.ProxyInstance).SomeMethod();
return callNext();
}
TargetMember
The member (property, event or method) that is being targeted.
Declaration
MemberInfo TargetMember { get; }
Property Value
Type | Description |
---|---|
System.Reflection.MemberInfo |
TargetMethod
The concrete method behind the TargetMember.
Declaration
MethodInfo TargetMethod { get; }
Property Value
Type | Description |
---|---|
System.Reflection.MethodInfo |
UserData
Custom user data meant to share state among interceptors in the invocation chain.
Declaration
object UserData { get; set; }
Property Value
Type | Description |
---|---|
System.Object |
Methods
InvokeInterceptor()
Invokes the actual interceptor. Meant for private use only.
Declaration
object InvokeInterceptor()
Returns
Type | Description |
---|---|
System.Object |