internal static IContainer AddDebugAdapterClientInternals(this IContainer container, DebugAdapterClientOptions options, IServiceProvider?outerServiceProvider) { container = container.AddDebugAdapterProtocolInternals(options); if (options.OnUnhandledException != null) { container.RegisterInstance(options.OnUnhandledException); } else { container.RegisterDelegate(_ => new OnUnhandledExceptionHandler(_ => { }), Reuse.Singleton); } container.RegisterInstance <IOptionsFactory <DebugAdapterClientOptions> >(new ValueOptionsFactory <DebugAdapterClientOptions>(options)); container.RegisterInstance( new InitializeRequestArguments { Locale = options.Locale, AdapterId = options.AdapterId !, ClientId = options.ClientId, ClientName = options.ClientName, PathFormat = options.PathFormat, ColumnsStartAt1 = options.ColumnsStartAt1, LinesStartAt1 = options.LinesStartAt1, SupportsMemoryReferences = options.SupportsMemoryReferences, SupportsProgressReporting = options.SupportsProgressReporting, SupportsVariablePaging = options.SupportsVariablePaging, SupportsVariableType = options.SupportsVariableType, SupportsRunInTerminalRequest = options.SupportsRunInTerminalRequest, }
internal static IContainer AddDebugAdapterServerInternals(this IContainer container, DebugAdapterServerOptions options, IServiceProvider?outerServiceProvider) { container = container.AddDebugAdapterProtocolInternals(options); if (options.OnUnhandledException != null) { container.RegisterInstance(options.OnUnhandledException); } else { container.RegisterDelegate(_ => new OnUnhandledExceptionHandler(_ => { }), Reuse.Singleton); } container.RegisterInstance <IOptionsFactory <DebugAdapterServerOptions> >(new ValueOptionsFactory <DebugAdapterServerOptions>(options)); container.RegisterInstance(options.Capabilities); container.RegisterInstance(options.RequestProcessIdentifier); container.RegisterMany <DebugAdapterServerProgressManager>(nonPublicServiceTypes: true, reuse: Reuse.Singleton); container.RegisterMany <DebugAdapterServer>( serviceTypeCondition: type => type == typeof(IDebugAdapterServer) || type == typeof(DebugAdapterServer), reuse: Reuse.Singleton, setup: Setup.With(condition: req => req.IsResolutionRoot || req.Container.Resolve <IInsanceHasStarted>().Started) ); container.RegisterMany <DefaultDebugAdapterServerFacade>( serviceTypeCondition: type => type.IsClass || !type.Name.Contains("Proxy") && typeof(DefaultDebugAdapterServerFacade).GetInterfaces().Except(typeof(DefaultDebugAdapterServerFacade).BaseType !.GetInterfaces()).Any(z => type == z), reuse: Reuse.Singleton ); // container. var providedConfiguration = options.Services.FirstOrDefault(z => z.ServiceType == typeof(IConfiguration) && z.ImplementationInstance is IConfiguration); container.RegisterDelegate <IConfiguration>( _ => { var builder = new ConfigurationBuilder(); if (outerServiceProvider != null) { var outerConfiguration = outerServiceProvider.GetService <IConfiguration>(); if (outerConfiguration != null) { builder.CustomAddConfiguration(outerConfiguration, false); } } if (providedConfiguration != null) { builder.CustomAddConfiguration((providedConfiguration.ImplementationInstance as IConfiguration) !); } return(builder.Build()); }, Reuse.Singleton ); return(container); }
internal static IContainer AddDebugAdapterServerInternals(this IContainer container, DebugAdapterServerOptions options, IServiceProvider outerServiceProvider) { container = container.AddDebugAdapterProtocolInternals(options); if (options.OnUnhandledException != null) { container.RegisterInstance(options.OnUnhandledException); } else { container.RegisterDelegate(_ => new OnUnhandledExceptionHandler(e => { }), Reuse.Singleton); } container.RegisterInstance <IOptionsFactory <DebugAdapterServerOptions> >(new ValueOptionsFactory <DebugAdapterServerOptions>(options)); container.RegisterInstance(options.Capabilities); container.RegisterInstance(options.RequestProcessIdentifier); container.RegisterMany <DebugAdapterServerProgressManager>(nonPublicServiceTypes: true, reuse: Reuse.Singleton); container.RegisterMany <DebugAdapterServer>( serviceTypeCondition: type => type == typeof(IDebugAdapterServer) || type == typeof(DebugAdapterServer), reuse: Reuse.Singleton ); // container. var providedConfiguration = options.Services.FirstOrDefault(z => z.ServiceType == typeof(IConfiguration) && z.ImplementationInstance is IConfiguration); container.RegisterDelegate <IConfiguration>( _ => { var builder = new ConfigurationBuilder(); if (outerServiceProvider != null) { var outerConfiguration = outerServiceProvider.GetService <IConfiguration>(); if (outerConfiguration != null) { builder.AddConfiguration(outerConfiguration, false); } } if (providedConfiguration != null) { builder.AddConfiguration(providedConfiguration.ImplementationInstance as IConfiguration); } return(builder.Build()); }, Reuse.Singleton ); return(container); }
internal static IContainer AddDebugAdapterClientInternals( this IContainer container, DebugAdapterClientOptions options, IServiceProvider?outerServiceProvider ) { container = container.AddDebugAdapterProtocolInternals(options); if (options.OnUnhandledException != null) { container.RegisterInstance(options.OnUnhandledException); } else { container.RegisterDelegate(_ => new OnUnhandledExceptionHandler(_ => { }), Reuse.Singleton); } container.RegisterInstance <IOptionsFactory <DebugAdapterClientOptions> >(new ValueOptionsFactory <DebugAdapterClientOptions>(options)); container.RegisterInstance( new InitializeRequestArguments { Locale = options.Locale, AdapterId = options.AdapterId, ClientId = options.ClientId, ClientName = options.ClientName, PathFormat = options.PathFormat, ColumnsStartAt1 = options.ColumnsStartAt1, LinesStartAt1 = options.LinesStartAt1, SupportsMemoryReferences = options.SupportsMemoryReferences, SupportsProgressReporting = options.SupportsProgressReporting, SupportsVariablePaging = options.SupportsVariablePaging, SupportsVariableType = options.SupportsVariableType, SupportsRunInTerminalRequest = options.SupportsRunInTerminalRequest, } ); container.RegisterInstance(options.RequestProcessIdentifier); container.RegisterMany <DebugAdapterClientProgressManager>(nonPublicServiceTypes: true, reuse: Reuse.Singleton); container.RegisterMany <DebugAdapterClient>( serviceTypeCondition: type => type == typeof(IDebugAdapterClient) || type == typeof(DebugAdapterClient), reuse: Reuse.Singleton, setup: Setup.With(condition: req => req.IsResolutionRoot || req.Container.Resolve <IInsanceHasStarted>().Started) ); container.RegisterMany <DefaultDebugAdapterClientFacade>( serviceTypeCondition: type => type.IsClass || (!type.Name.Contains("Proxy") && typeof(DefaultDebugAdapterClientFacade).GetInterfaces() .Except(typeof(DefaultDebugAdapterClientFacade).BaseType !.GetInterfaces()).Any(z => type == z)), reuse: Reuse.Singleton ); // container. var providedConfiguration = options.Services.FirstOrDefault(z => z.ServiceType == typeof(IConfiguration) && z.ImplementationInstance is IConfiguration); container.RegisterDelegate <IConfiguration>( _ => { var builder = new ConfigurationBuilder(); if (outerServiceProvider != null) { var outerConfiguration = outerServiceProvider.GetService <IConfiguration>(); if (outerConfiguration != null) { builder.CustomAddConfiguration(outerConfiguration, false); } } if (providedConfiguration != null) { builder.CustomAddConfiguration((providedConfiguration.ImplementationInstance as IConfiguration) !); } return(builder.Build()); }, Reuse.Singleton ); return(container); }