public RealObject(IReflectionCaller remoteCaller, object target) { this.identity = Guid.NewGuid(); this.remoteCaller = remoteCaller; this.target = target; RegisterHandlers(); }
public object CreateProxy(Type targetType, Guid identity, IReflectionCaller remoteCaller) { Type[] interfaces = GetTopInterfaces(targetType); ProxyGenerationOptions options = new ProxyGenerationOptions(); options.BaseTypeForInterfaceProxy = typeof(ProxyObject); ProxyGenerator generator = new ProxyGenerator(); ProxyObject proxy = (ProxyObject)generator.CreateInterfaceProxyWithoutTarget(interfaces[0], interfaces.Skip(1).ToArray(), options, Interceptor); proxy.Init(identity, remoteCaller); return(proxy); }
/// <summary> /// Set the object identiy /// </summary> /// <param name="identity"></param> /// <param name="remoteCaller"></param> public void Init(Guid identity, IReflectionCaller remoteCaller) { this.indentity = identity; this.remoteCaller = remoteCaller; }
public T CreateProxy <T>(Guid identity, IReflectionCaller remoteCaller) { return((T)CreateProxy(typeof(T), identity, remoteCaller)); }