Justa.DynamicProxy

Example: creates a dynamic proxy around a the specified Mock object and delegates execution to a method invoker.
  public void Sample() 
  {
      MockService service = new MockService();
      IMockService proxy = ProxyFactory<IMockService>(service, Invoker);
      proxy.Calculate(10, 5);
  }

  public object Invoker(object target, MethodInfo method, object[] parameters) 
  {
      // do something before method invocation
      object result =  method.Invoke(target, parameters);
      // do something after method invocation.
      return result;
  }


Last edited Jun 6, 2007 at 6:40 AM by aperez, version 2

Comments

No comments yet.