internal static object CreateClientProxyForContextBound(Type type, object[] activationAttributes) { if (type.IsContextful) { // Look for a ProxyAttribute ProxyAttribute att = (ProxyAttribute)Attribute.GetCustomAttribute(type, typeof(ProxyAttribute), true); if (att != null) { return(att.CreateInstance(type)); } } RemotingProxy proxy = new RemotingProxy(type, ChannelServices.CrossContextUrl, activationAttributes); return(proxy.GetTransparentProxy()); }
private static MarshalByRefObject IsCurrentContextOK(RuntimeType serverType, object[] props, bool bNewObj) { MarshalByRefObject proxy = null; InitActivationServices(); ProxyAttribute proxyAttribute = GetProxyAttribute(serverType); if (object.ReferenceEquals(proxyAttribute, DefaultProxyAttribute)) { return(proxyAttribute.CreateInstanceInternal(serverType)); } proxy = proxyAttribute.CreateInstance(serverType); if (((proxy != null) && !RemotingServices.IsTransparentProxy(proxy)) && !serverType.IsAssignableFrom(proxy.GetType())) { throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Activation_BadObject"), new object[] { serverType })); } return(proxy); }
// Create an instance of ServicedComponentProxy public override MarshalByRefObject CreateInstance(Type serverType) { mIsServiceComponent = serverType.IsSubclassOf(typeof(ServicedComponent)); MarshalByRefObject lTarget = null; if (mIsServiceComponent) { lTarget = mBase.CreateInstance(serverType); } else { lTarget = base.CreateInstance(serverType); } RealProxy lRealProxy = new ONRealProxy(lTarget, serverType); return(lRealProxy.GetTransparentProxy() as MarshalByRefObject); }
private static MarshalByRefObject IsCurrentContextOK(RuntimeType serverType, object[] props, bool bNewObj) { ActivationServices.InitActivationServices(); ProxyAttribute proxyAttribute = ActivationServices.GetProxyAttribute((Type)serverType); MarshalByRefObject marshalByRefObject; if (proxyAttribute == ActivationServices.DefaultProxyAttribute) { marshalByRefObject = proxyAttribute.CreateInstanceInternal(serverType); } else { marshalByRefObject = proxyAttribute.CreateInstance((Type)serverType); if (marshalByRefObject != null && !RemotingServices.IsTransparentProxy((object)marshalByRefObject) && !serverType.IsAssignableFrom(marshalByRefObject.GetType())) { throw new RemotingException(string.Format((IFormatProvider)CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Activation_BadObject"), (object)serverType)); } } return(marshalByRefObject); }