/// <summary> /// Called when an <see cref="T:System.ServiceModel.InstanceContext" /> object recycles a service object. /// </summary> /// <param name="instanceContext">The service's instance context.</param> /// <param name="instance">The service object to be recycled.</param> public void ReleaseInstance(InstanceContext instanceContext, object instance) { instanceContext.GetScope()?.Dispose(); }