using Microsoft.Extensions.DependencyInjection; namespace Connected.ServiceModel { internal class ContextProvider : IContextProvider { public IContext Create() { var scope = RuntimeStartup.Application.Services.CreateScope(); var ctx = scope.ServiceProvider.GetService() as Context; ctx.Scope = scope; return ctx; } } }