StructureMap: Creation as a transient (per query) does not work

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

How to build objects with an IOC container

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

Unity ResolveAll Generic Interface

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>

IoC Container for Windows Phone 8.1

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

How to solve the circular dependence

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

Is this the right way to create the view in the castle?

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

TinyIoC and the decorator motif

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

Repository Template with IoC - how should it be used correctly?

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

Activator.CreateInstance - Can not use return type

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

How to AutoWire an object without Spring XML context file?

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

Circular reference with my bootloader / unit

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

Injection dependency - the right place to inject

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

Common Service Registry

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

ASP.NET MVC3 - Use DependencyResolver AND Windsor Castle: Why?

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

Castle Windsor proxies, implicit interfaces and WPF binding

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

Autowiring Map does not work as expected

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

What are the best DI-IOC references for a vb.net programmer?

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

How does Unity.Resolve know which constructor to use?

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

Automatic annotation in spring without using component scanning

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

IoC.Resolve vs Injection Builder

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

Injectable FilterAttribute never reaches the filter

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

UNITY: Transmit a new data context each time?

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