void IServiceBehavior.Validate(ServiceDescription description, ServiceHostBase serviceHostBase) { serviceHostBase.Closed += delegate { ThreadAffinityHelper.CloseThread(m_ServiceType); }; }
public CallbackThreadAffinityBehaviorAttribute(Type clientType, string threadName) { m_ThreadName = threadName; m_ClientType = clientType; AppDomain.CurrentDomain.ProcessExit += delegate { ThreadAffinityHelper.CloseThread(m_ClientType); }; }
void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime clientRuntime) { m_ThreadName = m_ThreadName ?? "Executing callbacks of " + m_ClientType; ThreadAffinityHelper.ApplyDispatchBehavior(m_ClientType, m_ThreadName, clientRuntime.CallbackDispatchRuntime); }
void IContractBehavior.ApplyDispatchBehavior(ContractDescription description, ServiceEndpoint endpoint, DispatchRuntime dispatchRuntime) { m_ThreadName = m_ThreadName ?? "Executing endpoints of " + m_ServiceType; ThreadAffinityHelper.ApplyDispatchBehavior(m_ServiceType, m_ThreadName, dispatchRuntime); }