dependency-injection

Configuration Injection Framework

I recently stumbled upon the following Configuration Injection Framework. Seems interesting and seems to fit my needs. Has anyone tried it or knows about some other Configuration Injection frameworks? As far as I know Spring and Google Guice does not support this kinds of injection? ...

Multiple language components/classes [OOP/Patterns/IoC/DI]

I have several components for which there exists different versions, depending on the language used by the system (configurable, and can be changed at runtime). For example, I have an interface ("component") for Tokenizer, and two concrete implementations for english and chinese, like so: public interface Tokenizer { List<String> to...

Guice: Varying the type injected according to how the owner has been injected

I have a guice based app that now needs multiple instances of a given type so I plan on using a named annotation to disambiguate the dependencies. However a dependency of this type also needs to vary based on which one I get. To illustrate lets say I have @Singleton public class FooCache { private final FooCacheListener listener; ...

Getting multiple guice singletons of the same type

can you get 2 singleton instances of the same underlying type? this is obviously trivial in spring as it is based on named instances to which you attach a scope but I can't see the equivalent in guice which is about binding types to implementation classes. Note that I don't want to have to bind to the instance as the instances in quest...

Ninject not firing?

I'm trying to set up Ninject for the first time. I've got an IRepository interface, and a Repository implementation. I'm using ASP.NET MVC, and I'm trying to inject the implementation like so: public class HomeController : Controller { [Inject] public IRepository<BlogPost> _repo { get; set; } public ActionResult Index() {...

Simple Factory using StructureMap

Posted this on the structuremap group as well. We just started using structuremap last week, and are really digging it. I'm sure I'm missing something simple. I am trying to mimic the following code, using SM within my factory. I'm ok with having the container dependency in the factory class. The consensus in this thread seemed ...

Web client software factory CreateNewAttribute property not working in global.asax

We are using the following code in a code behind page [CreateNew] public AdminController Controller { get; set; } and the following code within the controller class [ServiceDependency] public IAdminService Adminervice { get; set; } this works fine for a normal aspx page. I would like to audit a Session starting event in my applica...

IoC/DI Container in a Windows Mobile Appication

Should I have any concerns about using a IoC/DI Container, specifically ninject, in a windows mobile app using the compact framework 3.5? ...

How to send a parameter to an object's constructor with Unity's Resolve<>() method?

Using Unity in Prism, I would like to send a parameter to the object's constructor like this: PSEUDO-CODE: SmartFormPresenter smartFormPresenter1 = this.container.Resolve<SmartFormPresenter(customer)>(); But instead I have to instatiate it and then assign a property: SmartFormPresenter smartFormPresenter1 = this.container.Re...

Where to instantiate Data Context (adapter, connection, session, etc) in MVC?

We are building an ASP.NET MVC site, and I'm struggling with where to define a connection to best enable unit testing (I use 'connection' generically - it could be a session, a connection, an adapter, or any other type of data context that can manage transactions and database operations). Let's say we have 3 classes: UserController U...

Unit Testing Assemblies Running Out Of Process

Anybody out there have experience testing "out of process assemblies"? I'm testing some Com+ (Serviced Component) and WCF services configured to be activated out of process and I'm not sure what the best practices are for testing in these situations. What I've done is given the public classes their own IOC container that they can buil...

dependency browser that runs against an inversion of control framework

Do any inversion of control / dependency injection framworks support viewing the object dependencies that have been registered? This is not to execute the code, but to better understand it. It seems that a graph based on the information it has (class A depends on B and C, class B dependencs on C and E, etc) would really document a syst...

Dependency Injection Question - ASP.NET

I'm starting a web application that contains the following projects: Booking.Web Booking.Services Booking.DataObjects Booking.Data I'm using the repository pattern in my data project only. All services will be the same, no matter what happens. However, if a customer wants to use Access, it will use a different data repository than if t...

What should I consider when choosing a dependency injection framework for .NET

see also Which C#/.NET Dependency Injection frameworks are worth looking into? There are now many dependency injection frameworks to choose from. You used to often be forced to use a given dependency injection framework due to a library you were using. However the Common Service Locator library has enabled library code to be i...

Attribute to add to an Interface for the default concrete class?

This probably isn't possible, but it's annoying enough to try... For convenience sake I'd like to be able to select "Go to definition" on a property or method on a variable defined as an interface and have Visual Studio go to the concrete implementation instead of the interface. Is there an attribute or something that I can use to instr...

Is there a good DI framework suitable for Java 1.4 and SE (Swing) apps?

I am looking for a dependency injection framework for a Java SE (Swing) application that runs under JDK 1.4. Are there any recommended DI frameworks that I can use? (Guice and other annotation-based frameworks are out, and I don't want to mess with something like Retroweaver.) Also, is Spring suitable for use in a Java SE application? ...

Factories, or Dependency Injection for object instantiation in WCF, when coding against an interface?

Hi I am writing a client/server application, where the client is a Windows Forms app, and the server is a WCF service hosted in a Windows Service. Note that I control both sides of the application. I am trying to implement the practice of coding against an interface: i.e. I have a Shared assembly which is referenced by the client appli...

How to consume a webservice from an EJB

I am currently trying to wrap my mind around Java EE 5. What I'd like to do is create a sample application that offers a simple stateless EJB (e. g. a simple calulator with an add() method) expose this add method as a webservice consume this webservice from another EJB The first two steps are easy and I can deploy and test this bean ...

How to apply dependency injection to UserControl views while keeping Designer happy?

public class StatisticsViewPresenter { private IStatisticsView view; private Statistics statsModel; public StatisticsViewPresenter(IStatisticsView view, Statistics statsModel) { this.view = view; this.statsModel = statsModel; } } I don't use events (but am willing to if it can solve my problem), so ...

A methology that allows for a single Java code base covering many different versions?

I work in a small shop where we have a LOT of legacy Cobol code and where a methology has been adopted to allow us to minimize forking and branching as much as possible. For a given release we have three levels: CORE - bottom layer, this code is common to all releases GROUP - optional code common to several customers. CUSTOMER - optio...