public InvocationT(object proxy, InvocationHandler invocationHandler, MethodInfo method, PropertyInfo property, object[] arguments, Func <Invocation, T> implementation) : base(proxy, invocationHandler, method, property, arguments)
 {
     this.implementation = implementation;
 }
Exemple #2
0
 ///  <summary>
 ///  Creates a proxy for a given type.  This method supports two discrete usage scenarios.<p/>
 ///  If T is an interface, the target should be an implementation of that interface. In
 ///  this scenario, T should be <i>explicitly</i> specified unless the type of <i>target</i>
 ///  at the calling site is of that interface.  In other words, if the calling site has the
 ///  <i>target</i> declared as the concrete implementation, the proxy will be generated
 ///  for the implementation, rather than for the interface.
 ///
 ///  If T is a class, the target should be an instance of that class, and a subclassing
 ///  proxy will be created for it.  However, because target is specified in this case,
 ///  the base class behavior will be ignored (it will all be delegated to the target).
 ///  </summary>
 ///  <typeparam name="T">The type to create the proxy for.  May be an interface or a
 ///  concrete base class.</typeparam>
 ///  <param name="invocationHandler">This is where you get to inject your logic.</param>
 ///  <returns>The new instance of the proxy that is an instance of T</returns>
 public static T CreateProxy <T>(InvocationHandler invocationHandler)
 {
     return(CreateProxy(default(T), invocationHandler));
 }
Exemple #3
0
 /// <summary>
 /// Creates a proxy for a given type.  This method supports two discrete usage scenarios.<p/>
 /// If T is an interface, the target should be an implementation of that interface. In
 /// this scenario, T should be <i>explicitly</i> specified unless the type of <i>target</i>
 /// at the calling site is of that interface.  In other words, if the calling site has the
 /// <i>target</i> declared as the concrete implementation, the proxy will be generated
 /// for the implementation, rather than for the interface.
 ///
 /// If T is a class, the target should be an instance of that class, and a subclassing
 /// proxy will be created for it.  However, because target is specified in this case,
 /// the base class behavior will be ignored (it will all be delegated to the target).
 /// </summary>
 /// <typeparam name="T">The type to create the proxy for.  May be an interface or a
 /// concrete base class.</typeparam>
 /// <param name="target">The instance of T that should be the recipient of all invocations
 /// on the proxy via Invocation.Proceed.</param>
 /// <param name="invocationHandler">This is where you get to inject your logic.</param>
 /// <returns>The new instance of the proxy that is an instance of T</returns>
 public static T CreateProxy <T>(T target, InvocationHandler invocationHandler)
 {
     return(Proxy <T> .CreateProxy(target, invocationHandler));
 }
Exemple #4
0
 public VoidInvocation(object proxy, InvocationHandler invocationHandler, MethodInfo method, PropertyInfo property, object[] arguments, Action <Invocation> implementation) : base(proxy, invocationHandler, method, property, arguments)
 {
     this.implementation = implementation;
 }