public void AssertActivityStarted()
{
if (CurrentThreadActivity == null)
{
if (HttpContext.Current != null)
throw new InvalidOperationException("The web request is not associated with the Amnesia session. Call Session.StartActivity() first.");
throw new InvalidOperationException("Thread " + Thread.CurrentThread.ManagedThreadId + " (" + Thread.CurrentThread.Name + ") is not associated with the Amnesia session. Call Session.StartActivity() first.");
}
}