Skip to content

Instantly share code, notes, and snippets.

@brsmith080
brsmith080 / continue.cs
Created February 1, 2017 02:52
continue to task
public static Task<TNewResult> ContinueWithTask<TContinue, TNewResult>(this Task<TContinue> task, Func<Task<TContinue>, Task<TNewResult>> Continuation, CancellationToken CancellationToken)
{
var Completion = new TaskCompletionSource<TNewResult>();
task.ContinueWith(t =>
{
if (CancellationToken.IsCancellationRequested)
{
Completion.SetCanceled();
return;
}
@brsmith080
brsmith080 / new_gist_file
Created June 21, 2013 14:44
autofac ss adapter stuff
var Provider = new RequestLifetimeScopeProvider(AutofacContainer.RootScope.Value, null);
AutofacServiceStackAdapter.ScopeProvider = Provider;