I've been doing MVC for several months now, and I store everything in my $registry object. When I create a new class, I only ever pass the registry usually, but I'm having to constantly pass the $this->registry when creating a new class. e.g. class s
I'm trying to solve a IoC problem, that seemed easy at first, but turned out to be a pain in the ass:-P I have a heavy weight main class, which must be initialized only once, so it's marked as Singleton. However this class uses a subclass which must
I believe I understand enough about dependency injection to get started with it, but I'm having trouble understanding IOC containers vs service location, and how to construct my objects utilizing the container. Given: public interface IFooService { v
I'm using Unity IoC, I'd like to register mapping of non generic class to generic interface. After that I'd like to use ResolveAll method for retrieve all registration associated to generic interface. This is the sample code: interface ISample<out T>
So I figured I'd try to actually use this fancy IoC container in Laravel. I'm starting with Guzzle but I cannot get it to work. Perhaps there is a gap in my understanding. I really appreciate any help here. so I've got a class for connecting to a RES
I'm currently working on a WP 8.1 app(runtime, not silverlight) and I want to find a IoC container. I'm using Caliburn.Micro, which is great because it's using constructor injection in the view models, but I also have a background agent which can't a
When using Spring4D, how can I pass a string value as a parameter when calling GlobalContainer. Resolve so that this string value is used on the resolved class constructor? I want to resolve a class IWorker that is mapped to a TWorker. The TWorker cl
Hi I have a problem with the structure of my code, it somehow goes into Circular Dependency. Here is an explanation of how my code looks like: I have a ProjectA contains BaseProcessor and BaseProcessor has a reference to a class called Structure in P
I have a factory class that creates a couple of different types of class. The factory is registered with the container. What is the recommended way of creating the classes inside the factory, given that they also have dependencies. I clearly want to
I am using the Castle Windsor V3.2.1 in my WPF MVVM Application. This is my Installer: public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store) { container.AddFacility<Type
Can someone please provide a simple example of how to implement the decorator pattern with TinyIoC? A previous question shows how to do this in Ninject with the following: Bind<IRepository>().To<MoreAdvancedRespository> .WhenInjectedInto<Tr
I am a lone developer and Pluralsight is my salvation in helping me understand things like Repository and IoC, which I am just learning. However I am finding the pattern awkward to use. So I am using Unity IoC, and following ModelContainer class; pub
I am trying to hand-roll my own IoC tool. This is a part of IoC code: public static object Resolve(Type contract) { Type Implementation = typeSettings[contract]; ConstructorInfo constructor = Implementation.GetConstructors()[0]; ParameterInfo[] const
I have an Interface with Component annotation and some classes that implemented it as follows: @Component public interface A { } public class B implements A { } public class C implements A { } Also, I have a class with an Autowired variable like this
I have a web-application which is dependent on two other modules. For simplicity let's call them ServiceA module and ServiceB module. Each of these modules has various different dependencies and also a common dependency on the Entities module. Each o
Can anyone help. I have a serious problem with my Unity and bootloader. Its a circular reference.. Let me explain what i have currently. MainApp (winforms) ServiceLayer - c# project DependencyInjection - c# Project for the Container Bootloader - c# p
Looking at this answer on SO, I am a bit confused by the following "principle": Apply the Hollywood Principle The Hollywood Principle in DI terms says: Don't call the DI Container, it'll call you. Never directly ask for a dependency by calling a
For a long time now we've been fortunate enough to have the Common Service Locator (CSL) to resolve services from an unknown source. However, there has never been any container-agnostic solution for registering these services in the first place. We'v
Can somebody shine a little light for me? I've got my website all running using Windsor Castle. I have a controller factory and installers for controllers and services. All nice. Now I've just created a IDependencyResolver implementing class called W
So I have a piece of software containing a brunch of service classes. Those services take some dependencies though their respective constructors. I have designed with dependency injection in mind, but developers who are going to build on top of the s
I am attempting to implement a WPF ViewModel using Castle Windsor Dynamic Proxies. The idea is that I want to supply an interface (IPerson below should suffice as an example), a concrete backing class, and an interceptor (for providing automatic impl
I'm using Spring 3.0.4. I have some beans that use the @Autowired annotation on Maps. These maps are defined within an application-context.xml file (as these maps are constructed using several factory methods). When I use my debugger, I can see the m
I'm looking at converting some of our complex creation code to use an IoC container, Autofac, and because I'm a great believer in TDD, I'm writing unit tests for the Module configuration. Most of the functionality is very easy to test e.g. var obj =
I code primarily in vb.net. I've been doing basic dependency injection manually and am looking to learn more about DI/IoC and maybe use a DI/IoC framework/container like Ninject. There are lots of examples and write-ups using Java and C# code. I'm lo
Given a class with several constructors - how can I tell Resolve which constructor to use? Consider the following example class: public class Foo { public Foo() { } public Foo(IBar bar) { Bar = bar; } public Foo(string name, IBar bar) { Bar = bar; Na
Is it possible to autowire beans using the @Autowired annotation without using component scanning?Yes. <context-component-scan .. /> is responsible for discovering beans annotated with @Component, @Controller, @Service, @Respository, etc. In order t
I heard a lot of people saying that it is a bad practice to use IoC.Resolve(), but I never heard a good reason why (if it's all about testing than you can just mock the container, and you're done). now the advantages of using Resolve instead of Const
On my base controller I have placed the Logger attribute. This LoggerAttribute looks like this: public class LoggerAttribute: InjectableFilterAttribute { public override Type FilterType { get { return typeof (LoggerActionFilter); } } } The ctor on th
I am trying to use unity to automatically inject a datacontext on my repository using a new instance each time.., my idea is the ensure that each time a new datacontext is injected Currently its failing on creating the repository, i think it can't re
I'm starting to get into Unit Testing, Dependancy Injection and all that jazz while constructing my latest ASP.NET MVC project. I'm to the point now where I would like to Unit Test my Controllers and I'm having difficulty figuring out how to appropri