Transfer contextual information to a new thread in your application

Follow

By default context information is lost when you go to a new thread. The Apprenda API offers a way to snapshot your current context and send it across threads, an example of the code you need to use is written below:

Apprenda.SaaSGrid.ContextSnapshot ctx = Apprenda.SaaSGrid.ContextSnapshot.Acquire();

return Task.Factory.StartNew(() =>
{
ctx.EstablishContext();
using (var proxy = new IncidentRequestManagementServiceProxy())
{
return proxy.GetIncident(incidentId);
}
});

Have more questions? Submit a request

Comments