public Task Resolve(HttpContext context) { var routeValues = context.GetRouteData().Values; IAggregateRoot root = context.RequestServices.GetService(typeof(IAggregateRoot)) as IAggregateRoot; var session = context.Session; if (session.GetString("something") == default(string)) { session.SetString("something", "this is really something"); } var results = root.GetResponse(routeValues); return(context.Response.WriteAsync(results)); }