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
1 answer

DryIoc : Can't figure out how to register IDisposable Decorator object

I'm trying to setup a decorator around an IDisposable db context: c.Register(setup: Setup.With(trackDisposableTransient: true)); // c.Register(setup: Setup.Decorator); If i uncomment the last…
Sté
  • 195
  • 11
1
vote
1 answer

DryIOC Decorator and InResolutionScopeOf

I'm trying to setup a dependency which I want to be injected in the resolution scope of a base interface (of MediatR handlers): container.Register(reuse: Reuse.InResolutionScopeOf(typeof(IAsyncRequestHandler<,>))); However, this…
djed
  • 141
  • 10
1
vote
1 answer

DryIoc with all classes Singleton and DbContext as WebRequest

I am trying to create completely Singleton applications (Web and Console). But the Entity DbContext should be used PerWebRequest on web. How should I register it on container to support this? I understand once the class has been initialized as a…
1
vote
1 answer

Registering an assembly is also registering enums

I am using DRYIOC for DI in my application. I have interfaces in my MVC application which I want to register to dryIOC. So I am using RegisterMany as below. container.RegisterMany(new[] { Assembly.Load(DIAssemblyCollection["WebAssembly"]) }, …
Nayana Setty
  • 1,001
  • 1
  • 12
  • 34
1
vote
1 answer

How use implementation with private constructor in DryIoc?

public class MyClass : IMyClass { internal MyClass() { } } container.Resolve(); How to configure DryIoc to use the constructor of MyClass in case when it is internal, protected or even private?
Maxim
  • 13,029
  • 6
  • 30
  • 45
1
vote
1 answer

DryIoc Registry Class

I Like StructureMap's registry feature for helping me to group IOC Registrations together: http://structuremap.github.io/registration/registry-dsl/ I'm using DryIOC as my Container - its working great - but I'm in a situation where my registry class…
reach4thelasers
  • 26,181
  • 22
  • 92
  • 123
1
vote
1 answer

Inject service with different configuration into controller

In a Web API application, I have two controllers, MyAController and MyBController, each depending on IMyService but with a different configuration: public class MyAController : ApiController { private readonly IMyService service; public…
smolesen
  • 1,153
  • 3
  • 11
  • 29
1
vote
1 answer

Migration from Autofac How to Resolve?

Orchard caching design: public interface ICacheManager { ICache GetCache(); } class DefaultCacheManager : ICacheManager { public DefaultCacheManager(Type component, ICacheHolder cacheHolder) { //do…
try
  • 55
  • 5
1
vote
1 answer

DryIoc registering default primitives

I have a boostrapper for the Caliburn.Micro MVVM framework where I just auto register all ViewModels in the assembly. Some ViewModels have constructors with parameters, and I usually overwrite these manually (using the Register-parameter…
kasperhj
  • 10,052
  • 21
  • 63
  • 106
1
vote
1 answer

Registering simple types in a specific example

Consider the following ClassA has a constructor that takes an instance of MasterClass and a string and exposes a property called Names of type string[]. ClassB has a constructor that takes an IJuicePresser and a IEnumerable. ClassC has a…
kasperhj
  • 10,052
  • 21
  • 63
  • 106
1
vote
1 answer

Registering and resolving dependencies in a loop

I have the following hardcoded setup in an application using MVVM: var ips = configFile.Read(); for (string ip in ips) { var tcpClient = new TcpClient(ip); var stream = (Stream) tcpClient.GetStream(); var service = new Service(stream); …
kasperhj
  • 10,052
  • 21
  • 63
  • 106
1
vote
1 answer

Override certain implementation when resolving a dependency

I have read to documentation and can't find anything about resolving a type and at the same time override some of its dependencies. Easiest to illustrate with an example public class A { public A(IServiceA a, IServiceB b) {} } // Resolve…
joacar
  • 891
  • 11
  • 28
1
vote
1 answer

DryIoc, Spring.Net's GetObjectsOfType equivalent?

With Spring.Net, it's possible to query all objects of a certain (ancestor) type. var ctx = ContextRegistry.GetContext(); var setUsers = ctx.GetObjectsOfType(typeof(ISetUser)).Values.OfType().ToList(); How can this be…
Serge Intern
  • 2,669
  • 3
  • 22
  • 39
1
vote
1 answer

DryIoc, How to register transcient reuse (aka null) when default is set otherwise?

With dryIoc I have registered my container as such: var container = new Container(rules => rules .WithoutThrowOnRegisteringDisposableTransient() .WithDefaultReuseInsteadOfTransient(Reuse.Singleton) ); But…
Serge Intern
  • 2,669
  • 3
  • 22
  • 39
1
vote
1 answer

DryIoc - Resolving a dervied class when base class is registered with a key name

Trying to build support for DryIoc in Prism.Forms (https://github.com/joacar/Prism/tree/pr-517) and stumbled upon a scenarion I can't manage to work out how to do. To make a long story short the issues boils down to this: When creating a new…
joacar
  • 891
  • 11
  • 28