/// <summary> /// Initializes a new instance of the <see cref="WcfService"/> class. /// </summary> public WcfService() { this.callback = OperationContext.Current.GetCallbackChannel <IInvokeCallback>(); OperationContext.Current.Channel.Closed += new EventHandler(Channel_Closed); OperationContext.Current.Channel.Faulted += new EventHandler(Channel_Faulted); ICommunicationObject CallBackObject = (ICommunicationObject)callback; if (logger == null) { logger = DefaultContainer.LoggerFactory.CreateLogger <WcfService>("Framework"); } LocalDataStoreSlot slot = Thread.GetNamedDataSlot("SessionThreadSlot"); SlotData slotdata = Thread.GetData(slot) as SlotData; if (slotdata == null) { slotdata = new SlotData(); } slotdata.CallBack = callback; Thread.SetData(slot, slotdata); if (!callbacks.Contains(callback)) { callbacks.Add(callback); } }
public void Dispose() { if (callbacks.Contains(callback)) { callbacks.Remove(callback); callback = null; logger.Debug("一个客户端回调对象及服务对象被销毁"); } }
public void Dispose() { if (callbacks.Contains(callback)) { callbacks.Remove(callback); callback = null; logger.Debug("一个客户端回调对象及服务对象被销毁"); } }
/// <summary> /// Initializes a new instance of the <see cref="WcfService"/> class. /// </summary> public WcfService() { this.callback = OperationContext.Current.GetCallbackChannel<IInvokeCallback>(); OperationContext.Current.Channel.Closed += new EventHandler(Channel_Closed); OperationContext.Current.Channel.Faulted += new EventHandler(Channel_Faulted); ICommunicationObject CallBackObject = (ICommunicationObject)callback; if (logger == null) { logger = DefaultContainer.LoggerFactory.CreateLogger<WcfService>("Framework"); } LocalDataStoreSlot slot = Thread.GetNamedDataSlot("SessionThreadSlot"); SlotData slotdata = Thread.GetData(slot) as SlotData; if (slotdata == null) { slotdata = new SlotData(); } slotdata.CallBack = callback; Thread.SetData(slot, slotdata); if (!callbacks.Contains(callback)) { callbacks.Add(callback); } }
public void Invoke <T1, T2>(IInvokeCallback <T1, T2> callback, T1 arg1, T2 arg2) { InvokeWrappedMethod(_factory.Wrap <T1, T2>(callback, arg1, arg2)); }
public void Invoke <T>(IInvokeCallback <T> callback, T state) { InvokeWrappedMethod(_factory.Wrap <T>(callback, state)); }
public void Invoke(IInvokeCallback callback) { InvokeWrappedMethod(_factory.Wrap(callback)); }
public InvokeCallbackWrapper(IInvokeCallback callback) { _callback = callback; }
void IServerInvoker.Invoke <T1, T2>(IInvokeCallback <T1, T2> callback, T1 arg1, T2 arg2) { Contract.Requires(callback != null); }
void IServerInvoker.Invoke <T>(IInvokeCallback <T> callback, T state) { Contract.Requires(callback != null); }
void IServerInvoker.Invoke(IInvokeCallback callback) { Contract.Requires(callback != null); }