inversion-of-control

IoC container for Objective-C

Hi, Is there any IoC container for Objective-C? ...

NHibernate conversation with ASP.NET+IoC+PostSharp?

Does anybody know a good example of how an NHibernate conversation can be used in a Web context (ASP.NET or ASP.NET MVC) using an IoC container and AOP? Personally, I use Castle/Windsor and PostSharp, but I will appreciate everything that points me to the right direction. ...

How to avoid anemic domain models, or when to move methods from the entities into services

I have a common scenario that I am looking for some guidance from people more experienced with DDD and Domain Modeling in general. Say I start out building a blog engine, and the first requirement is that after an Article is posted, users can start posting Comments on it. This starts fine, and leads to the following design: public clas...

Dependency injection through constructors or property setters?

Hi, I hope this isn't a duplicate. I did a search but there are a lot of dependency injection posts and I couldn't find any needles in the haystack. So here's my question. I'm refactoring a class and adding a new dependency to it. The class is currently taking its existing dependencies in the constructor. So for consistency, I add the p...

Linq to SQL & Castle IoC Container sanity check please

I've just started using both Linq to SQL and Windsor Castle IoC container for a new web app and, although things seem to be working OK in preliminary tests, I could really do with a sanity check on it. I was running into problems when I tried to pull objects out of the database using Linq in different parts of the app and then updating ...

Dependency Injection as a Language Feature?

Are there any existing modern-day programming languages that explicitly have dependency injection as a language feature, and if so, are there any examples of how such programming languages use their syntax to separate program dependencies from their concrete implementations? (Please Note: I'm not looking for an DI/IOC framework--I'm act...

Castle Windsor (or other DI) - creating object based on parameter

Hi there! I am pretty new to the whole DI/IoC thing, so bear with me... I have this kind of setting: interface IA interface IB interface IC abstract class A : IA class B : A, IB class C : A, IC interface IX interface IY interface IZ abstract class X : IX class Y : X, IY class Z : X, IZ B and C's constructors look like this: public...

spring: a bean that receives a list of Classes

I want to define in my Spring XML context a bean that has a property of the type List of classes: i.e. List<Class<?>> classes How do I send that bean a number of classes, say java.lang.String and java.lang.Integer? The list needs not be reusable, i.e. I will not refer to it in another bean. ...

Don’t know enough to know if this design is a great idea or an incredibly dumb one …

Using C#, asp.net 3.5, SqlServer 2005, Trying to incorporate some inversion of control together with 3-tier architecture into my current assignment. Don’t know enough to know if this is a great idea or an incredibly dumb one: I have created a User Interface Layer, a Business Layer, and a Data Layer. The UI collects 4 values, News a...

small footprint dependency injection java

I am looking for a very lightweight dependency injection framework for java. With minimum possible dependencies and minimum features. Just something along the following lines: receive a java.util.List of Classes, instantiate them and just auto-wire all the objects one into the other. ...

Structure map and generics (in XML config)

Hi I'm using the latest StructureMap (2.5.4.264), and I need to define some instances in the xml configuration for StructureMap using generics. However I get the following 103 error: Unhandled Exception: StructureMap.Exceptions.StructureMapConfigurationException: StructureMap configuration failures: Error: 103 Source: Requested Plugi...

Can you do conventions-based binding with StructureMap 2.5.3?

I find one of the best features of Ninject is conventions-based binding. eg. Bind<IConfigurationSource>().To<RemoteConfigurationSource>() .Only(When.Context.Target.Name.BeginsWith("remote")); Bind<IConfigurationSource>().To<LocalConfigurationSource>() .Only(When.Context.Target.Name.BeginsWith("local")); http://ninject.codeplex.com/Wi...

What performance overhead do IoC containers involve?

Hi, Loose coupling is wonderful of course, but I have often wondered what overhead wiring up dynamically using an IoC container (for example Castle Windsor) has over a tightly coupled system? I know that a detailed answer would depend on what the IoC was being used for, but I'm really just trying to get a feel for the magnitude of effo...

Dependency injection in NerdDinner - actually testing your repository or model

Consider a beginner dealing with Dependency Injection. We're analyzing two relevant classes in NerdDinner. DinnerRepository from the application: FakeDinnerRepository from the tests: They implement different logic, which of course is necessary, as the key idea here is to implement the IDinnerRepository, and provide different impleme...

Can inversion of control and RAII play together?

I was just reading up on inversion of control (IOC) and it bothered me that it seems like it makes memory management a pain. Of course it seems ioc is mostly used in garbage collected environments (Net,Java,Scripting), while my concern is in non-gc settings. My concern here is that IOC in a way goes against RAII, as we decouple resource...

List all types registered with a Castle Windsor container instance

Hi, What's the easiest way of programatically listing registered types in Castle Windsor? Thanks ...

Prefer Dependency-Injection over Partial Mocking?

I know this SO question, but it deals with the subject in more general terms. Should I prefer using partial Mocks over Dependency Injection? My question is based on the following quote from OCMock: id aMock = [OCMockObject partialMockForObject:anObject] Creates a mock object that can be used in the same way as anObject. When a ...

Mocking without IoC or Dependency Injection

Hi All, Is there a way to use mocks or fakes in your unit tests without having to use dependency injection or inversion or control? I found this syntax can be used with TypeMock Isolator (http://learn.typemock.com/). It is a comercial product though, so I was hoping that other frameworks (such as RhinoMocks) would be introducing such s...

Manage autofac container setup

One of my team members decided to use autofac on one of our services and because we wanted to try it out we stuck with it. Now some time has passed and the container setup method has grown! It so big that we are having problems with it. Splitting it up did not bring the results we looked for. Maybe we are just using it wrong. So my ...

Events in an Inversion of Control (Dependency Inversion) system go which way?

Up or Down? I'm a very visual person. I'm thinking of my application as a hierarchy, where the top is the root and the bottom is a leaf. I'm also under the understanding that IoC containers are ignorant of their contained objects' responsibilities/functions. Instead, the contained objects know about their container, i.e. "context", via...