Questions tagged [dryioc]

DryIoc is small, fast, capable IoC Container for .NET

DryIoc provides modern take on IoC/DI automation with Simplicity of use, Performance, and Features in mind.

236 questions
1
vote
0 answers

Automatically resolve certain services when scope opens

I need a scoped service A that reacts on events from service B, and then does something on service C. In my architecture I have marked those kinds of services with a marker interface. The service subscribes to event sources from the injected service…
onixion
  • 11
  • 2
1
vote
1 answer

DryIoc: register decorator with two interfaces, retrieve the decorator instance when resolving the other interface

Here is a somewhat simplified description of the problem I'm trying to solve: I have a service (e.g. a repository) implementing an interface that I need to inject as a dependency: public class Service : IService { ... } I'd like to add a decorator,…
1
vote
1 answer

DryIOC - overriding the transient/scoped registration for a nested scope

I want to override the transient (or scoped) registration within the (nested) scope. Is this possible? I found I can achieve that with IScope.Use for instances, but how to achieve that for transients? Consider the situation when you can optionally…
Sz. Moncz
  • 109
  • 1
  • 5
1
vote
0 answers

Proper way to handle prism navigation exception

I am using Prism Wpf 8.1.97, and DryIoc container. In my scenario i have to navigate between two views, so I implemented the INavigationAware Interface provided by Prism Framework in my viewModels. I call the IRegionManager RequestNavigate method to…
1
vote
1 answer

dryioc - get target type while registration

Is it possible to get type of target (consumer) of the resolved instance while registration? Basically something like this: Determine the target type for a dependency during resolution but for dryioc.
raV720
  • 564
  • 3
  • 27
1
vote
1 answer

Check an service created before in DryIoC

How to check a service created before in current scope in DryIoC? I want to prevent create a service, if already isn't created using dryioc. I want a function like IsResolved in this example: container.Register(); if…
emdadgar2
  • 820
  • 1
  • 9
  • 15
1
vote
2 answers

Register dynamic Mapping (or delegate without explicitly resolving)

I have the following registrations prior to the one my question is about: container.Register(); container.Register(); container.Register(); Connection1 and Connection2 both implement an the interface…
Christoph Mett
  • 369
  • 3
  • 16
1
vote
1 answer

Set up DryIoc with an old asp.net mvc (not core)

I have an old Asp.net mvc application using Microsoft.aspnet mvc 5.2.7 I would like to use DryIoc but I could not find any example on how to use it. I have added the DryIoc.MVC nuget but with somehow does not see any "WithMVC" extentions. Am I…
developer9969
  • 4,628
  • 6
  • 40
  • 88
1
vote
1 answer

Define primitive resolve-time values in attribute on constructor parameter in DryIoC

In my code there's a dependency (MyDependency) that I want to be resolved in a class (MyClass). The dependency has a few dependencies itself as well as a primitive constructor parameter (primValue), that should be defined by the resolving class.…
Christoph Mett
  • 369
  • 3
  • 16
1
vote
1 answer

Extending Prism IContainerRegistry to register by name specifying constructor

I'm trying to migrate a Prism WPF application whitch is using Unity IoC container to use DryIoC container. In a module I have the Unity container injected to register a class specifying the constructor. unityContainer.RegisterType
JuanDYB
  • 590
  • 3
  • 9
  • 23
1
vote
1 answer

Error while injecting Serilog "Prism.DryIoc DryIoc.Microsoft.DependencyInjection6.0.0 "

I have this code. protected override IContainerExtension CreateContainerExtension() { var serviceCollection = new ServiceCollection(); serviceCollection.AddLogging(configure => { …
ShuSong Lu
  • 33
  • 5
1
vote
1 answer

Register to be created from factory

I'm trying to use DryIOC to resolve a scoped entity framework context. While this registration works, it feels weird: container.Register( Reuse.ScopedTo(), Made.Of(() =>…
Haukinger
  • 10,420
  • 2
  • 15
  • 28
1
vote
1 answer

DryIOC equivalent of Unity's PerResolveLifetimeManager

How to simulate Unity's PerResolveLifetimeManager with DryIoc? That is, reuse within the current call to resolve, but not otherwise: var a = container.Resolve(); Assert( ReferenceEquals(a.B.D, a.C.D ) ); var a2 = container.Resolve(); Assert(…
Haukinger
  • 10,420
  • 2
  • 15
  • 28
1
vote
1 answer

Resolving multiple instances of interface implementation using Dry IOC

I have a scenario where there are multiple classes that implement the same interface. the consuming class is to get all the interface implementations as a list so that it can invoke method on all the instances. public interface IDoSomething { …
TrustyCoder
  • 4,749
  • 10
  • 66
  • 119
1
vote
1 answer

DryIOC service registered as singleton but new instance is being injected per request

We have a class in our .net6 WebAPI project used for two-level caching. We inject two instances of an ICacheClient interface, one used for short-term caching and one used for long-term. One of the caches is configured as a singleton, but it is…
Anduril
  • 1,236
  • 1
  • 9
  • 33