public TResult ExecuteOnRemoteSide <TResult>(RemoteSideIDType remoteSideID, RemoteOperationDescriptor rso) { ThrowIfNotInitialized(); TResult ret = (TResult)ExecuteOnRemoteSideInternal(remoteSideID, rso); return(ret); }
public RemoteRequest CreateRequest(RemoteOperationDescriptor rso) { if (rso == null) { throw new ArgumentNullException("rso"); } RemoteRequest ret = new RemoteRequest(); ret.ExecuteOnRemoteSideOperation = rso; return(ret); }
public override void ReadXml(XmlReader reader) { base.ReadXml(reader); try { reader.ReadStartElement("ExecuteOnRemoteSideOperation"); this.ExecuteOnRemoteSideOperation = (RemoteOperationDescriptor)SerializationHelper.DeserializeFromXml(reader); reader.ReadEndElement(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); throw; } }
protected virtual object ExecuteOnRemoteSideInternal(RemoteSideIDType remoteSideID, RemoteOperationDescriptor rso) { object ret = null; if (remoteSideID == null) { throw new ArgumentNullException("remoteSideID"); } if (rso == null) { throw new ArgumentNullException("rso"); } // find appropriate client IRemoteSideCommunicationContract contract = null; bool lockTaken = false; try { syncRoot.Enter(ref lockTaken); communicationContractsByRemoteSideIDDict.TryGetValue(remoteSideID, out contract); } finally { if (lockTaken) { syncRoot.Exit(); } } if (contract != null) { RemoteRequest req = remoteOperationHandler.CreateRequest(rso); req.RemoteID = remoteSideID; RemoteResponse resp = null; try { RequestToRemoteSideStarted(remoteSideID, rso); resp = contract.ExecuteRequest(req); } finally { RequestToRemoteSideFinished(remoteSideID, rso); } ret = remoteOperationHandler.HandleResponse(resp); } else { throw new InvalidOperationException(String.Format("Unknown remote side id: {0}", remoteSideID)); } return(ret); }
protected virtual void RequestToRemoteSideFinished(RemoteSideIDType remoteSideID, RemoteOperationDescriptor rso) { }
public void ExecuteOnRemoteSide(RemoteSideIDType remoteSideID, RemoteOperationDescriptor rso) { ThrowIfNotInitialized(); ExecuteOnRemoteSideInternal(remoteSideID, rso); }