public void RegisterServices(GlimpseCoreServiceCollectionBuilder services) { services.AddOptions(); // // Common // services.AddSingleton <IServerBroker, DefaultServerBroker>(); services.AddSingleton <IStorage, InMemoryStorage>(); services.AddSingleton <IResourceManager, ResourceManager>(); // // Options // services.AddTransient <IConfigureOptions <GlimpseCoreServerOptions>, GlimpseCoreServerOptionsSetup>(); services.AddTransient <IExtensionProvider <IAllowClientAccess>, DefaultExtensionProvider <IAllowClientAccess> >(); services.AddTransient <IExtensionProvider <IAllowAgentAccess>, DefaultExtensionProvider <IAllowAgentAccess> >(); services.AddTransient <IExtensionProvider <IResource>, DefaultExtensionProvider <IResource> >(); services.AddTransient <IExtensionProvider <IResourceStartup>, DefaultExtensionProvider <IResourceStartup> >(); services.AddSingleton <IAllowRemoteProvider, DefaultAllowRemoteProvider>(); services.AddSingleton <IMetadataProvider, DefaultMetadataProvider>(); if (!services.Any(s => s.ServiceType == typeof(IMessagePublisher))) { services.AddSingleton <IMessagePublisher, InProcessPublisher>(); } if (services.Any(s => s.ServiceType == typeof(IResourceOptionsProvider))) { services.Replace(new ServiceDescriptor( typeof(IResourceOptionsProvider), typeof(DefaultResourceOptionsProvider), ServiceLifetime.Singleton)); } else { services.AddSingleton <IResourceOptionsProvider, DefaultResourceOptionsProvider>(); } }
public void RegisterServices(GlimpseCoreServiceCollectionBuilder services) { services.AddOptions(); RegisterPublisher(services); // // Common // services.AddMiddlewareAnalysis(); services.AddTransient <IGlimpseCoreAgent, GlimpseCoreAgent>(); services.AddSingleton <IAgentBroker, DefaultAgentBroker>(); // // Options // services.AddTransient <IConfigureOptions <GlimpseCoreAgentOptions>, GlimpseCoreAgentOptionsSetup>(); services.AddSingleton <IRequestIgnorerUriProvider, DefaultRequestIgnorerUriProvider>(); services.AddSingleton <IRequestIgnorerStatusCodeProvider, DefaultRequestIgnorerStatusCodeProvider>(); services.AddSingleton <IRequestIgnorerContentTypeProvider, DefaultRequestIgnorerContentTypeProvider>(); services.AddSingleton <IExtensionProvider <IRequestIgnorer>, DefaultExtensionProvider <IRequestIgnorer> >(); services.AddSingleton <IExtensionProvider <IInspectorFunction>, DefaultExtensionProvider <IInspectorFunction> >(); services.AddSingleton <IExtensionProvider <IInspector>, DefaultExtensionProvider <IInspector> >(); services.AddSingleton <IExtensionProvider <IAgentStartup>, DefaultExtensionProvider <IAgentStartup> >(); // // Messages // services.AddSingleton <IMessageConverter, DefaultMessageConverter>(); services.AddTransient <IMessagePayloadFormatter, DefaultMessagePayloadFormatter>(); services.AddTransient <IMessageIndexProcessor, DefaultMessageIndexProcessor>(); services.AddTransient <IMessageTypeProcessor, DefaultMessageTypeProcessor>(); // // Common // services.AddTransient <IAgentStartupManager, DefaultAgentStartupManager>(); services.AddTransient <IRequestIgnorerManager, DefaultRequestIgnorerManager>(); services.AddTransient <IInspectorFunctionManager, DefaultInspectorFunctionManager>(); services.AddTransient <IExceptionProcessor, ExceptionProcessor>(); services.AddTransient <WebDiagnosticsListener>(); if (!services.Any(s => s.ServiceType == typeof(IResourceOptionsProvider))) { services.AddSingleton <IResourceOptionsProvider, OptionsResourceOptionsProvider>(); } }