Get session service using IServiceProvider
问题 I need to access session variable in ConfigureService method in ASP.NET Core 1.0 using IServiceProvider. I have a service that is initialized with delegate/lambda expression that can return value from any place. In this context this lambda expression argument should return value from session once called. Here is example code: public void ConfigureServices(IServiceCollection services) { services.AddTransient<IMyService>(serviceProvider => { return new MyService(() => { var session =