/// <summary>Retrieves a service from the scope or returns null if not resolved.</summary> public object GetService(Type serviceType) => ScopedContainer.Resolve(serviceType, _throwIfUnresolved != null && _throwIfUnresolved(serviceType) ? IfUnresolved.Throw : IfUnresolved.ReturnDefault);
protected T ResolveType <T>() { return(ScopeContext.Resolve <T>()); }
// typeof(MediatR.INotificationMediator<MediatR.Examples.Ponged>) internal static object Get1_INotificationMediator(IResolverContext r) { return(new MediatR.NotificationMediator <MediatR.Examples.Ponged>(new MediatR.INotificationHandler <MediatR.Examples.Ponged>[] { new MediatR.Examples.GenericHandler((System.IO.TextWriter)r.Resolve(typeof(System.IO.TextWriter), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(MediatR.INotificationMediator <MediatR.Examples.Ponged>), typeof(MediatR.INotificationMediator <>), (object)null, 52, FactoryType.Service, typeof(MediatR.NotificationMediator <MediatR.Examples.Ponged>), Reuse.Transient, RequestFlags.IsResolutionCall).Push(typeof(System.Collections.Generic.IEnumerable <MediatR.INotificationHandler <MediatR.Examples.Ponged> >), default(System.Type), (object)null, 2, FactoryType.Wrapper, default(System.Type), Reuse.Transient, ((RequestFlags)0)).Push(typeof(MediatR.INotificationHandler <MediatR.Examples.Ponged>), typeof(MediatR.INotificationHandler <MediatR.INotification>), (object)null, IfUnresolved.ReturnDefaultIfNotRegistered, 34, FactoryType.Service, typeof(MediatR.Examples.GenericHandler), Reuse.Transient, ((RequestFlags)0), 0), default(object[]))), new MediatR.Examples.PongedHandler((System.IO.TextWriter)r.Resolve(typeof(System.IO.TextWriter), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(MediatR.INotificationMediator <MediatR.Examples.Ponged>), typeof(MediatR.INotificationMediator <>), (object)null, 52, FactoryType.Service, typeof(MediatR.NotificationMediator <MediatR.Examples.Ponged>), Reuse.Transient, RequestFlags.IsResolutionCall).Push(typeof(System.Collections.Generic.IEnumerable <MediatR.INotificationHandler <MediatR.Examples.Ponged> >), default(System.Type), (object)null, 2, FactoryType.Wrapper, default(System.Type), Reuse.Transient, ((RequestFlags)0)).Push(typeof(MediatR.INotificationHandler <MediatR.Examples.Ponged>), default(System.Type), (object)DefaultKey.Of(0), IfUnresolved.ReturnDefaultIfNotRegistered, 43, FactoryType.Service, typeof(MediatR.Examples.PongedHandler), Reuse.Transient, ((RequestFlags)0), 0), default(object[]))) })); }
// typeof(MediatR.IRequestMediator<MediatR.Examples.Jing, MediatR.Unit>) internal static object Get3_IRequestMediator(IResolverContext r) { return(new MediatR.RequestMediator <MediatR.Examples.Jing, MediatR.Unit>(new MediatR.Examples.JingHandler((System.IO.TextWriter)r.Resolve(typeof(System.IO.TextWriter), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(MediatR.IRequestMediator <MediatR.Examples.Jing, MediatR.Unit>), typeof(MediatR.IRequestMediator <,>), (object)null, 60, FactoryType.Service, typeof(MediatR.RequestMediator <MediatR.Examples.Jing, MediatR.Unit>), Reuse.Transient, RequestFlags.IsResolutionCall).Push(typeof(MediatR.IRequestHandler <MediatR.Examples.Jing, MediatR.Unit>), 39, typeof(MediatR.Examples.JingHandler), Reuse.Transient), default(object[]))), new MediatR.IPipelineBehavior <MediatR.Examples.Jing, MediatR.Unit>[] { new MediatR.Pipeline.RequestPostProcessorBehavior <MediatR.Examples.Jing, MediatR.Unit>(new MediatR.Pipeline.IRequestPostProcessor <MediatR.Examples.Jing, MediatR.Unit>[] { new MediatR.Examples.GenericRequestPostProcessor <MediatR.Examples.Jing, MediatR.Unit>((System.IO.TextWriter)r.Resolve(typeof(System.IO.TextWriter), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(MediatR.IRequestMediator <MediatR.Examples.Jing, MediatR.Unit>), typeof(MediatR.IRequestMediator <,>), (object)null, 60, FactoryType.Service, typeof(MediatR.RequestMediator <MediatR.Examples.Jing, MediatR.Unit>), Reuse.Transient, RequestFlags.IsResolutionCall).Push(typeof(System.Collections.Generic.IEnumerable <MediatR.IPipelineBehavior <MediatR.Examples.Jing, MediatR.Unit> >), default(System.Type), (object)null, 2, FactoryType.Wrapper, default(System.Type), Reuse.Transient, ((RequestFlags)0)).Push(typeof(MediatR.IPipelineBehavior <MediatR.Examples.Jing, MediatR.Unit>), default(System.Type), (object)DefaultKey.Of(0), IfUnresolved.ReturnDefaultIfNotRegistered, 61, FactoryType.Service, typeof(MediatR.Pipeline.RequestPostProcessorBehavior <MediatR.Examples.Jing, MediatR.Unit>), Reuse.Transient, ((RequestFlags)0), 0).Push(typeof(System.Collections.Generic.IEnumerable <MediatR.Pipeline.IRequestPostProcessor <MediatR.Examples.Jing, MediatR.Unit> >), default(System.Type), (object)null, 2, FactoryType.Wrapper, default(System.Type), Reuse.Transient, ((RequestFlags)0)).Push(typeof(MediatR.Pipeline.IRequestPostProcessor <MediatR.Examples.Jing, MediatR.Unit>), default(System.Type), (object)DefaultKey.Of(1), IfUnresolved.ReturnDefaultIfNotRegistered, 62, FactoryType.Service, typeof(MediatR.Examples.GenericRequestPostProcessor <MediatR.Examples.Jing, MediatR.Unit>), Reuse.Transient, ((RequestFlags)0), 0), default(object[]))) }), new MediatR.Pipeline.RequestPreProcessorBehavior <MediatR.Examples.Jing, MediatR.Unit>(new MediatR.Pipeline.IRequestPreProcessor <MediatR.Examples.Jing>[] { new MediatR.Examples.GenericRequestPreProcessor <MediatR.Examples.Jing>((System.IO.TextWriter)r.Resolve(typeof(System.IO.TextWriter), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(MediatR.IRequestMediator <MediatR.Examples.Jing, MediatR.Unit>), typeof(MediatR.IRequestMediator <,>), (object)null, 60, FactoryType.Service, typeof(MediatR.RequestMediator <MediatR.Examples.Jing, MediatR.Unit>), Reuse.Transient, RequestFlags.IsResolutionCall).Push(typeof(System.Collections.Generic.IEnumerable <MediatR.IPipelineBehavior <MediatR.Examples.Jing, MediatR.Unit> >), default(System.Type), (object)null, 2, FactoryType.Wrapper, default(System.Type), Reuse.Transient, ((RequestFlags)0)).Push(typeof(MediatR.IPipelineBehavior <MediatR.Examples.Jing, MediatR.Unit>), default(System.Type), (object)DefaultKey.Of(1), IfUnresolved.ReturnDefaultIfNotRegistered, 63, FactoryType.Service, typeof(MediatR.Pipeline.RequestPreProcessorBehavior <MediatR.Examples.Jing, MediatR.Unit>), Reuse.Transient, ((RequestFlags)0), 0).Push(typeof(System.Collections.Generic.IEnumerable <MediatR.Pipeline.IRequestPreProcessor <MediatR.Examples.Jing> >), default(System.Type), (object)null, 2, FactoryType.Wrapper, default(System.Type), Reuse.Transient, ((RequestFlags)0)).Push(typeof(MediatR.Pipeline.IRequestPreProcessor <MediatR.Examples.Jing>), default(System.Type), (object)DefaultKey.Of(0), IfUnresolved.ReturnDefaultIfNotRegistered, 64, FactoryType.Service, typeof(MediatR.Examples.GenericRequestPreProcessor <MediatR.Examples.Jing>), Reuse.Transient, ((RequestFlags)0), 0), default(object[]))) }), new MediatR.Examples.GenericPipelineBehavior <MediatR.Examples.Jing, MediatR.Unit>((System.IO.TextWriter)r.Resolve(typeof(System.IO.TextWriter), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(MediatR.IRequestMediator <MediatR.Examples.Jing, MediatR.Unit>), typeof(MediatR.IRequestMediator <,>), (object)null, 60, FactoryType.Service, typeof(MediatR.RequestMediator <MediatR.Examples.Jing, MediatR.Unit>), Reuse.Transient, RequestFlags.IsResolutionCall).Push(typeof(System.Collections.Generic.IEnumerable <MediatR.IPipelineBehavior <MediatR.Examples.Jing, MediatR.Unit> >), default(System.Type), (object)null, 2, FactoryType.Wrapper, default(System.Type), Reuse.Transient, ((RequestFlags)0)).Push(typeof(MediatR.IPipelineBehavior <MediatR.Examples.Jing, MediatR.Unit>), default(System.Type), (object)DefaultKey.Of(2), IfUnresolved.ReturnDefaultIfNotRegistered, 65, FactoryType.Service, typeof(MediatR.Examples.GenericPipelineBehavior <MediatR.Examples.Jing, MediatR.Unit>), Reuse.Transient, ((RequestFlags)0), 0), default(object[]))) })); }
/// <summary> /// Resolves the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public object Resolve(Type type) { return(_resolverContext.Resolve(type)); }
public static IFileSystem ResolveTargetFileSystem( this IResolverContext context) { return(context.Resolve <IFileSystem>(ServiceKeys.TARGET)); }
public object Resolve(Type type) { return(_resolverContext.Resolve(type, IfUnresolved.Throw)); }
/// <summary>Delegates resolution to scoped container. In case the service is unresolved /// depending on provided policy it will either fallback to default DI resolver, /// or will throw the original DryIoc exception (cause it good to know the reason).</summary> /// <param name="serviceType">Service type to resolve.</param> /// <returns>Resolved service object.</returns> public object GetService(Type serviceType) => _scopedResolver.Resolve(serviceType, _throwIfUnresolved == null || !_throwIfUnresolved(serviceType));
// typeof(Prism.Services.Dialogs.IDialogService) internal static object Get10_IDialogService(IResolverContext r) { return(new Prism.Services.Dialogs.DialogService(new Prism.Common.ApplicationProvider(), (Prism.Ioc.IContainerExtension)r.Resolve(typeof(Prism.Ioc.IContainerExtension), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(Prism.Services.Dialogs.IDialogService), default(System.Type), null, 35, FactoryType.Service, typeof(Prism.Services.Dialogs.DialogService), Reuse.Transient, RequestFlags.IsResolutionCall), default(object[])))); }
// typeof(Prism.Navigation.INavigationService) internal static object Get14_INavigationService(IResolverContext r) { return(new Prism.Navigation.PageNavigationService((Prism.Ioc.IContainerExtension)r.Resolve(typeof(Prism.Ioc.IContainerExtension), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(Prism.Navigation.INavigationService), default(System.Type), "PageNavigationService", 40, FactoryType.Service, typeof(Prism.Navigation.PageNavigationService), Reuse.Transient, RequestFlags.IsResolutionCall), default(object[])), new Prism.Common.ApplicationProvider(), new Prism.Behaviors.PageBehaviorFactory(), new Prism.Logging.EmptyLogger())); }
// typeof(Prism.Modularity.IModuleManager) internal static object Get9_IModuleManager(IResolverContext r) { return(new Prism.Modularity.ModuleManager(new Prism.Modularity.ModuleInitializer((Prism.Ioc.IContainerExtension)r.Resolve(typeof(Prism.Ioc.IContainerExtension), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(Prism.Modularity.IModuleManager), default(System.Type), null, 38, FactoryType.Service, typeof(Prism.Modularity.ModuleManager), Reuse.Transient, RequestFlags.IsResolutionCall).Push(typeof(Prism.Modularity.IModuleInitializer), 39, typeof(Prism.Modularity.ModuleInitializer), Reuse.Transient), default(object[]))), new Prism.Modularity.ModuleCatalog())); }
// typeof(PrismZero.ViewModels.MainPageViewModel) internal static object Get8_MainPageViewModel(IResolverContext r) { return(new PrismZero.ViewModels.MainPageViewModel(new Prism.Navigation.PageNavigationService((Prism.Ioc.IContainerExtension)r.Resolve(typeof(Prism.Ioc.IContainerExtension), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(PrismZero.ViewModels.MainPageViewModel), default(System.Type), null, 45, FactoryType.Service, typeof(PrismZero.ViewModels.MainPageViewModel), Reuse.Transient, RequestFlags.IsResolutionCall).Push(typeof(Prism.Navigation.INavigationService), 28, typeof(Prism.Navigation.PageNavigationService), Reuse.Transient), default(object[])), new Prism.Common.ApplicationProvider(), new Prism.Behaviors.PageBehaviorFactory(), new Prism.Logging.EmptyLogger()), (PrismZero.Services.Hello.HelloService)r.SingletonScope.GetOrAdd(41, () => new PrismZero.Services.Hello.HelloService(), 0))); }
public static IFileSystem ResolveArchiveFileSystem( this IResolverContext context) { return(context.Resolve <IFileSystem>(ServiceKeys.ARCHIVE)); }
IDisposable IHandlersManager.Add(Type handlerType, JsonRpcHandlerOptions options) => Add(_resolverContext.Resolve(handlerType) as IJsonRpcHandler, options);
public IDisposable Add(Type handlerType, JsonRpcHandlerOptions options) => AddHandler(_resolverContext.Resolve(handlerType) as IJsonRpcHandler, options);
public HelpHandler(IResolverContext context) { _logger = context.Resolve <ILogger>(); }
// typeof(IService) internal static object Get_0_IService(IResolverContext r) { return(new MyService(new DependencyA(), new DependencyB <string>(), (RuntimeDependencyC)r.Resolve(typeof(RuntimeDependencyC), null, DryIoc.IfUnresolved.Throw, default(System.Type), DryIoc.Request.Empty.Push(typeof(IService), default(System.Type), null, 138, DryIoc.FactoryType.Service, typeof(MyService), DryIoc.Reuse.Transient, DryIoc.RequestFlags.IsResolutionCall), default(object[])))); }
public void Handle(IResolverContext context, Action <IResolverContext> next) { context.Resolve <List <int> >().Add(number); next(context); }
/// <summary> /// Gets a scoped instance of service Type /// </summary> /// <param name="serviceType"></param> /// <param name="key"></param> /// <returns></returns> public object Get(Type serviceType, string key = null) => _resolveContext.Resolve(serviceType);
/// <inheritdoc /> public object GetService(Type serviceType) => _resolverContext.Resolve(serviceType, IfUnresolved.ReturnDefaultIfNotRegistered);
public static IFileSystem ResolveSourceFileSystem( this IResolverContext context) { return(context.Resolve <IFileSystem>(ServiceKeys.SOURCE)); }