public object ResolveReference(object context, string reference) { var id = new Guid(reference); lock (((IDictionary)_knownDtos).SyncRoot) { if (_knownDtos.TryGetValue(id, out var value)) { if (!value.TryGetTarget(out var target)) { Logger.Debug("Could not get target {0}", id); ProxyObjectBase.TryResurect(id, out _); } Logger.Trace("Resolved reference {0} with {1}", reference, value); if (target == null) { Logger.Debug("NULL ON TARGET! {0}", reference); } return(target); } else if (ProxyObjectBase.TryResurect(id, out var target)) { return(target); } else { Logger.Warn("Unknown reference: {0}", reference); return(null); } } }
internal static bool TryResurect(Guid dtoGuid, out ProxyObjectBase finalizeRequested) { if (FinalizeRequested.TryGetValue(dtoGuid, out finalizeRequested)) { finalizeRequested.Resurrect(); return(true); } return(false); }
public void DeleteReference(Guid reference) { if (ProxyObjectBase.TryGetFinalizeRequested(reference, out var proxy)) { proxy.Finalized -= Proxy_Finalized; proxy.Resurrected -= Proxy_Resurrected; proxy.FinalizeProxy(); return; } Logger.Debug("Could not finalize resurrected proxy {0}", reference); }
public void Set(ProxyObjectBase dto, object value, string propertyName) { try { var queryMessage = SocketMessage.Create( SocketMessage.SocketMessageType.Set, dto, propertyName, 1, value); SendAndGetResponse <object>(queryMessage); } catch (Exception e) { Logger.Error("From Set {0}: {1}", dto, e); throw; } }
public void EventRemove(ProxyObjectBase dto, string eventName) { try { var queryMessage = SocketMessage.Create( SocketMessage.SocketMessageType.EventRemove, dto, eventName, 0, null); SendAndGetResponse <object>(queryMessage); } catch (Exception e) { Logger.Error("From Invoke {0}: {1}", dto, e); throw; } }
public T Get <T>(ProxyObjectBase dto, string propertyName) { try { var queryMessage = SocketMessage.Create( SocketMessage.SocketMessageType.Get, dto, propertyName, 0, null ); return(SendAndGetResponse <T>(queryMessage)); } catch (Exception e) { Logger.Error("From Get {0}: {1}", dto, e); throw; } }
public void Invoke(ProxyObjectBase dto, string methodName, params object[] parameters) { try { var queryMessage = SocketMessage.Create( SocketMessage.SocketMessageType.Query, dto, methodName, parameters.Length, new SocketMessageArrayValue { Value = parameters }); SendAndGetResponse <object>(queryMessage); } catch (Exception e) { Logger.Error("From Invoke {0}: {1}", dto, e); throw; } }
internal static bool TryGetFinalizeRequested(Guid dtoGuid, out ProxyObjectBase finalizeRequested) { return(FinalizeRequested.TryGetValue(dtoGuid, out finalizeRequested)); }
public ProxyObjectBaseEventArgs(ProxyObjectBase proxy) { Proxy = proxy; }