I've been using Castle Windsor in my previous project and I liked it a lot. For my current project I'm looking to use a different IoC container. Castle Windsor hasn't had any new releases since 2007 and is still not at version 1.0 so it is hard to justify using it in a commercial environment.
One of the things I like about Castle Windso...
Does anyone have good examples of IoC containers (preferably in c#) and how and why to use them ? I have checked out the wiki page and Ayende's example, but I don't quite get the concept yet.
And when and where should I use an IoC container ?
...
I am trying to understand Spring. I have read about it and done some tutorials. I kind of get the IoC paradigm and the fact that DI is its implementation in Spring.
My question is this: What do you lose by not using Spring? I understand this is a big question and somewhat subjective. But if you could write a few dot points or give an ex...
I'm only really familiar with AutoFac, and I asked if the feature detailed below was possible with it, and it seemed 'not exactly'. Do you know a container with which this would be possible?
[TestFixture]
public class SomeCunningTests
{
class SomeType { }
[Test]
public void TestRegistrationScope()
{
...
I have an IAddress class with a few properties. I then have a concrete type that implements this interface. This concrete type has a couple of different constructors I could use. How can I pass parameter values to one of these constructors at run-time? I cannot use the config file as I will be reusing this concrete type multiple time...
In other IoC containers like ninject you can setup contextual binding pretty easily. I was wondering if contextual binding was supported by the Spring.net IoC container?
...
Hi
I'm having trouble figuring out how to resolve objects that depend on objects that are non deterministically created at runtime. What is the best approach?
Imagine something like a word processor. For each document you open, you probably want to create a large number of objects that depend on the document object.
As an example, yo...
Although this question is related to StructureMap, my general question is:
When wiring up components with an IoC
container in code (as opposed
to configuring via xml) do you
generally need explicit project/build
references to all assemblies?
Why the separate assemblies? Because:
"Abstract classes residing in a
sepa...
For some of my Delphi / Free Pascal projects I consider using Dependency Injection.
Are there already implementations available (or in development) which provide some basic DI (IoC) functionality?
Edit: I am not looking for a .NET based solution for Delphi.Net or Prism - in this case, the question would have been: which one should I pic...
I keep getting a stackoverflow exception when I call "GetInstance" (the last line). All, yes ALL of my types implement ITracker. MultiTracker has a constructor with a single parameter, which is an array of ITracker's.
It seems like StructureMap is ignoring the fact that I told it that MultiTracker is the default class I want when reques...
When unit-testing objects which have a composition relationship with another object (a "has-a" relationship), as I understand it, you can only really mock the composed objects if you are using dependency injection of some sort. Hence, code of the following kind make unit-testing very difficult and might therefore be considered a bad thi...
Hello,
I have a problem to understand how to use IoC in a scenario where I need to create objects dynamically. Lets assume I have this classes:
abstract class Field {
public Field( ICommandStack commandStack ) {}
}
abstract class Entity {
public readonly Collection<Field> Fields { get; }
}
class EntityA {
public EntityA( IComma...
Another way to ask this question is: what is Inversion of Control according to you?
I ask this question because the Wikipedia article on IoC has been hijacked by a non-OO explanation. This is taken from the discussion page and is from 2007:
I took the liberty to completely rewrite the page, as the previous content was completely tak...
Currently I have a class that looks like this:
public class MyClass : IMyClass
{
public MyClass()
{
//...
}
public MyClass(IMyRepository repository)
{
//...
}
}
In my config file I have IMyClass registered, but not IMyRepository. My intention is for Windsor to use the constructor that doesn't take any pa...
Here's the current layout:
Solution:
Core
Domain
Interfaces
DataAccess
Providers
Session
Service
UI
UnitTests
IntegrationTests
I typically try to keep my core domain entities / POCOs as light as possible without very many external dependencies.. So I was thinking it might make sense to put it in the Service layer as it typical...
I'm new to IoC/DI frameworks. The first one I am trying is the Ninject framework. It seems straightforward, but I can't get my console application to run. I keep getting an ActivationException stating:
"Error activating MainWindow: the StandardProvider returned an instance of type FutureRealisticDateManager, which is not compatible wit...
Say I have two classes A and B, with B depending on A.
public class A {}
public class B {
public B(A a) {}
}
It's easy to resolve B in a single PicoContainer.
final MutablePicoContainer root = new PicoBuilder().build();
root.addComponent(new A());
root.addComponent(B.class, B.class);
System.out.println(root.getCo...
Hi all
Is it possible to get Windsor to return different implementations of a service based on a seperate parameter?
For example, if I have a User object which has a Role property, I would like to be able to hydrate this object differently according the the value of Role. I would like to use an IUserService to do this, but have the con...
How would you convert my current business logic layer method into IOC?
public static List<User> GetUsers()
{
MyDBProvider db = new MyDBProvider();
return db.GetUsers();
}
...
I am just getting started using any DI/IoC toolset and have a very basic question. I am using Unity as we will also be using a number of the Enterprise Library blocks throughout the application.
The question that I have is around the dependencies to .NET framework classes. For instance, in one of the classes that I am working on curre...