inversion-of-control

Ninject on asp.net Session state

I'm working with Ninject on a web application, using the BasePage and BaseMaster from the frameworks's integrations. What I would like to do is have an object injected and have a new instance created on each session. I've looked at the OnePerRequest behavior and it's close, but not quite. What I'm doing is performing a lot of calculati...

Spring.Net IoC Application Context Problem

Hi, I'm having the following "problem". I created a application context file for spring.net. The configuration looks like this: <spring> <context> <resource uri="config://spring/objects"/> </context> <objects configSource="SpringObjects.config" /> </spring> I was told that if you change something to the application context you...

Programatic IOC container wiring

When previously working with Castle Windsor I had a Castle.xml file that was a part of a solution folder. I then added this as a linked item to each project that was a errr.. looking for word... a startup/invoke project or a test project so I the same Castle.xml was part of Company.Server proj and Company.Server.Tests proj etc... It wor...

Unittesting IoC registration?

Should you unittest the code that registers components into your IoC container? If so, how? ...

StructureMap - Override constructor arguments for a named instance

Can you override the constructor arguments for a named instance, it seems you can only do it for a default instance. I would like to do: ObjectFactory.With("name").EqualTo("Matt").GetNamedInstance<IActivity>("soccer"); ...

IoC/DI Container that supports Compact Framework

Hi, Is their any IoC controllers available that will work on .NET Compact Framework? ...

Is there a .NET IoC that prefers convention over configuration?

Simply put, if you had to use a IoC/DI container, thats easy to deploy (not a big fan of using config/xml file for everything), stable, good documentation and supports .net, which one would it be? It could just be me but too many xml files like one for the app, a few for ORM, a few for another component kinda gets overwhelming at times....

How do forwarding types apply to IoC?

I'm still learning Castle Windsor and I see that it supports forwarded types - a term I was unfamiliar with. Quick Google search and I found this article that explains it pretty throughly however I still don't understand how this applies to IoC or how I would use them from a container and for what reason. Can anyone explain? ...

What conventions/idioms/patterns are you using configuring IOC Containers using the new Fluent Interfaces

I am in the middle of moving over a large body of code to Castle Trunk which includes the new fluent interface for configuring the container. Since the project has a huge windsorConfig xml file that is beyond maintainable, I thought I would start to take advantage of this new feature. I know other containers (e.g. StructureMap 2.0) also ...

Is it possible to view all services/types registered to StructureMap?

Hello, I am just trying out structuremap and would like to be able to see which of my classes are registered for which service. For example with castle windsor I can bring up the debugger and view container.Kernel.GraphNodes to see a list of all currently registered service/type pairings. Is there a similar view into StructureMap inter...

Library assembly IoC setup

I am working in a project that has two main parts: a class library assembly and the main application. Both are using Castle Windsor for IoC and both manually setup their list of of components in code (to aid refactoring and prevent the need for a config file). Currently the main application has code like this: public static void Main() ...

How to resolve instances with constructor parameters in custom IOC Container?

I'm trying to build my own inversion of control container. Right now I store the objects with their types in a dictionary and resolve a reference when asked. But I want to make it possible to resolve a reference or a new instance. I can create a new instance with the Activator class. But, what if the constructor of the object to resolve...

Convention over Configuration go against loose coupling?

Something a lot of programmers seem to be abiding by is Convention of Configuration. In the context of IoC this means using the API instead of XML configuration. How are you supposed to keep the loose coupling idea behind DI/IoC when you have to reference the DLL containing the concrete implementations of the abstract interfaces/classe...

Testing if a Type has been registered in Unity

Can I test if a type has been registered in a Unity container without calling for a Resolve and trapping the exception? ...

Best Practices for IOC Container

I'm using the Unity IOC container and I'm just wondering what is the best best way to access the container for multiple classes. Should every class have an IUnityContainer member and then pass the container in by constructor? Should there be a singleton class with an IOC container? How about asp.net development? Could somebody guide ...

Dealing with circular dependencies in IOC

I'm trying to use an IOC container to create the initial object graph within my application. I have a MainForm. This form depends on a MenuStrip, which depends on multiple MenuStripItems. Some MenuStripItems depend on the MainForm. At the moment I setup all dependencies for constructor injection. Obviously, resolving the MainForm now r...

How does Castle Windsor respond to a class which implements multiple interfaces?

For example I have two interfaces: ICustomerService and IOrderService which each has a couple of functions like GetCustomer, GetOrder, etc. I want one class to implement both interfaces: Server. How does Castle Windsor respond to this? Is it possible in the first place? When I resolve the Server object based on one of the two interfac...

Castle Windsor: How to prevent circular references in factory-created objects were the created objects refers back to the factory.

I am using windsor castle as my IoC container, and has run in to a bit of a problem. This is best explained in code, so I´ll give it a try. I have a factory class, that should provide me with implementations of a certain interface: public interface IObjectCreatorFactory { IObjectCreator GetObjectCreator(Type objectType); } public in...

Is there a recommend way to get Spring 2.5+ to autowire Hibernate domain objects

Is there a recommend way to get Spring 2.5+ to autowire Hibernate (3.0+) domain objects. I realize that there is a way to do this using AspectJ (@Configurable), but I would like to avoid pulling in AspectJ. Some Googling found this DependencyInjectionInterceptorFactoryBean class but it seems to just live in the sandbox (and just in 2.0....

Primitive types and IoC containers

How do you handle primitive types when using a IoC container? I.e. given that you have: class Pinger { private int timeout; private string targetMachine; public Pinger(int timeout, string targetMachine) { this.timeout = timeout; this.targetMachine = targetMachine; } public void CheckPing() { ...