void IServiceAttribute.AddService( IServiceCollection services, Type serviceType, Func <IServiceProvider, object> implementationFactory) { ServiceCollectionServiceExtensions.AddTransient( services, serviceType, implementationFactory); }
public DecoratorBuilder <TInterface> Default <TService>() where TService : class, TInterface { ServiceCollectionServiceExtensions.AddTransient <TService>(_services); var provider = ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(_services); _decoratedService = (TInterface)provider.GetService(typeof(TService)); return(this); }
void IServiceAttribute.AddService( IServiceCollection services, Type serviceType, Type implementationType) { ServiceCollectionServiceExtensions.AddTransient( services, serviceType, implementationType); }
public static WebApplicationFactory <TStartup> WithResponse <TStartup, TRequest, TResponse> (this WebApplicationFactory <TStartup> factory, TResponse response) where TStartup : class where TRequest : IRequest <TResponse> => factory.WithWebHostBuilder(c => { c.ConfigureTestServices(srv => { var mediatorMock = new Mock <IMediator>(); mediatorMock .Setup(m => m.Send(It.IsAny <TRequest>(), It.IsAny <CancellationToken>())) .ReturnsAsync(response); ServiceCollectionServiceExtensions.AddTransient(srv, _ => mediatorMock.Object); }); });
public void Configure(JasperRegistry registry) { // Not sure *why* you'd do this, but you could registry.Configuration.AddJsonFile("someFile.json"); // Add service registrations ServiceCollectionServiceExtensions.AddTransient <IFoo, Foo>(registry.Services); // Alter settings within the application registry.Settings.Alter <BusSettings>(_ => { _.JsonSerialization.TypeNameHandling = TypeNameHandling.All; }); // Register additional ASP.Net Core middleware, // but it'd probably be better to use an IStartupFilter // for ordering instead registry.Http.AddSomeMiddleware(); }
public static IServiceCollection AddHostingShellServices(this IServiceCollection services) { dummyVar0 = ServiceCollectionServiceExtensions.AddSingleton <IShellHost, ShellHost>(services); stackVariable2 = services; stackVariable3 = OrchardCore.Environment.Shell.ServiceCollectionExtensions.u003cu003ec.u003cu003e9__0_0; if (stackVariable3 == null) { dummyVar1 = stackVariable3; stackVariable3 = new Func <IServiceProvider, IShellDescriptorManagerEventHandler>(OrchardCore.Environment.Shell.ServiceCollectionExtensions.u003cu003ec.u003cu003e9.u003cAddHostingShellServicesu003eb__0_0); OrchardCore.Environment.Shell.ServiceCollectionExtensions.u003cu003ec.u003cu003e9__0_0 = stackVariable3; } dummyVar2 = ServiceCollectionServiceExtensions.AddSingleton <IShellDescriptorManagerEventHandler>(stackVariable2, stackVariable3); ServiceCollectionDescriptorExtensions.TryAddSingleton <IShellSettingsManager, SingleShellSettingsManager>(services); dummyVar3 = ServiceCollectionServiceExtensions.AddTransient <IConfigureOptions <ShellOptions>, ShellOptionsSetup>(services); dummyVar4 = ServiceCollectionServiceExtensions.AddSingleton <IShellContextFactory, ShellContextFactory>(services); dummyVar5 = ServiceCollectionServiceExtensions.AddSingleton <ICompositionStrategy, CompositionStrategy>(services); dummyVar6 = ServiceCollectionServiceExtensions.AddSingleton <IShellContainerFactory, ShellContainerFactory>(services); dummyVar7 = ServiceCollectionServiceExtensions.AddSingleton <IRunningShellTable, RunningShellTable>(services); return(services); }
public override void Process(IocArgs args) { ServiceCollectionServiceExtensions.AddTransient <IHistogramRepository, HistogramRepository>(args.ServiceCollection); ServiceCollectionServiceExtensions.AddTransient <IScatterPlotRepository, ScatterPlotRepository>(args.ServiceCollection); ServiceCollectionServiceExtensions.AddTransient <ISunburstRepository, SunburstRepository>(args.ServiceCollection); }
public override void Process(IocArgs args) { //TODO patch ServiceCollectionServiceExtensions.AddTransient <IHotspotImageRepository, HotspotImageRepository>(args.ServiceCollection); }