public object GetObject(Type type, string bus_name, ObjectPath path) { if (!CheckBusNameExists(bus_name)) { return(null); } //if the requested type is an interface, we can implement it efficiently //otherwise we fall back to using a transparent proxy if (type.IsInterface || type.IsAbstract) { return(BusObject.GetObject(this, bus_name, path, type)); } else { if (ProtocolInformation.Verbose) { Console.Error.WriteLine("Warning: Note that MarshalByRefObject use is not recommended; for best performance, define interfaces"); } BusObject busObject = new BusObject(this, bus_name, path); DProxy prox = new DProxy(busObject, type); return(prox.GetTransparentProxy()); } }
public static object GetObject(Connection conn, string bus_name, ObjectPath object_path, Type declType) { Type proxyType = TypeImplementer.Root.GetImplementation(declType); object instObj = Activator.CreateInstance(proxyType); BusObject inst = GetBusObject(instObj); inst.conn = conn; inst.bus_name = bus_name; inst.object_path = object_path; return(instObj); }
public static BusObject GetBusObject(object instObj) { if (instObj is BusObject) return (BusObject)instObj; BusObject inst; if (boCache.TryGetValue (instObj, out inst)) return inst; inst = new BusObject (); boCache[instObj] = inst; return inst; }
public object GetObject(Type type, string bus_name, ObjectPath path) { if (!CheckBusNameExists(bus_name)) { return(null); } //if the requested type is an interface, we can implement it efficiently //otherwise we fall back to using a transparent proxy if (type.IsInterface || type.IsAbstract) { return(BusObject.GetObject(this, bus_name, path, type)); } else { throw new ApplicationException("Warning: Note that MarshalByRefObject use is not available"); } }
public static BusObject GetBusObject(object instObj) { if (instObj is BusObject) { return((BusObject)instObj); } BusObject inst; if (boCache.TryGetValue(instObj, out inst)) { return(inst); } inst = new BusObject(); boCache[instObj] = inst; return(inst); }
public void WriteObject(Type type, object val) { ObjectPath path; BusObject bobj = val as BusObject; if (bobj == null && val is MarshalByRefObject) { bobj = ((MarshalByRefObject)val).GetLifetimeService() as BusObject; } if (bobj == null) { throw new Exception("No object reference to write"); } path = bobj.Path; Write(path); }
public DProxy (BusObject busObject, Type type) : base(type) { this.busObject = busObject; }
public DProxy(BusObject busObject, Type type) : base(type) { this.busObject = busObject; }