dependency-injection

Use Rhino Service Bus on ASP.NET website with Ninject

I will like to add Rhino Service Bus to my ASP.NET web application but using Ninject as the DI Container. So far all examples I keep seeing use Castle Windsor which I don't want to use since we already use Ninject. Are there any tutorials out there which show how to add Rhino Service Bus to an ASP.NET web application without a direct de...

Can DI frameworks provide singleton scope in EJB app. (varying classloader usage)?

Hi. Let's say I want to use an EJB container and I don't know how the container implementation is using classloaders. Now, I want to have in-memory shared state with my custom datastructures (so no HSQLDB etc.). in this app., and the EJB spec happens to be < EJB 3.1 and I can't use the EJB singleton service. If I'd use DI frameworks...

SmartUI developer trying to expand his horizons, can you explain what Dependancy Injection is?

Possible Duplicate: What is dependency injection? I've read the Wikipedia page. I've read an articulate explanation from a book from Apress. I still don't understand what it is, or why it's useful. StackOverflow seems to be the best place to ask this. :) Can an expert give me an easy to understand explanation? ...

Grails dependency injection no longer working after upgrade to Grails 1.3.3

Hi All, Project setup is Flex 3-BlazeDS-Spring Flex Integration-Grails Dependency injection in my Service classes was working just fine with Grails 1.2.1, when service methods were called from my flex client. When I upgraded my project to 1.3.3 yesterday using the regular 'grails upgrade' command, everything went well but once I start...

How can I decouple this C# worker thread code from the main thread for shared data variables?

How could I modify the below code such that I could, for better readability in code: a) move the "workThreadMethod()" into it's own class b) not have any code in this worker thread class reference static variables from the main "Program" class c) the above are the main two requirements, however I'm hoping that as a side effect this wo...

ASP.NET MVC2 + Ninject + NLog (+ shared hosting?) = NullReferenceException

I have an MVC2 app that's based on the Tekpub Starter Site, so it uses Ninject for dependency injection, NLog for logging, and a bunch of other libraries in various places. As far as I can tell though, it's these that are causing my problem. Everything works beautifully on my PC using the ASP.NET dev server (Cassini) but when I deploy ...

Best practices: Calling GetInstance method to instantiate object

Hello everyone. Lets discuss one thing: I have some simple interface: public interface ICar { void StartEngine(); void StopEngine(); } public interface IRadio { //doesn't matter } and some implementation: public class SportCar : ICar { private IRadio radio; public SportCar(IRadio radioObj) { radio = radioObj; ...

How can I inject a property only if the value is non-null at runtime using Unity?

Hi there, I have an interface to resolve and one of the mapped object's dependencies has a property on it which I would like to set with a value that I only have available when I resolve the top level object. There's no valid default value for the property. If its not set it should be null and it should only be set if the value that I ...

Name a simple Dependency Injection framework.

I would like to try using an DI/IoC framework for the first time in a small-ish but growing project, and I don't want to disturb the project much by introducing bulky dependencies. The project itself is partly intended to be used as a library in other projects, and I don't want to trouble users with managing extra dependencies. It's also...

Dependency injection and named loggers

I am interested in learning more about how people inject logging with dependency injection platforms. Although the links below and my examples refer to log4net and Unity, I am not necessarily going to use either of those. For dependency injection/IOC, I will probably use MEF as that is the standard that the rest of the project (large) ...

Global Google Guice module?

Is there a way to create a global guice module? so whenever someone calls the CreateInjector method of the Guice class it will get a specific "global" module? I am trying to do this because I have a set of compiled classes in a JAR that use the following: @Inject MyInterface.dosomething(); and I would like to be able to, in the proje...

Dependency injection, Scala and Spring

I love the concept of DI and loosely coupled system, a lot. However, I found tooling in Spring lacking at best. For example, it's hard to do "refactoring", e.g. to change a name of a bean declared in Spring. I'm new to Spring, so I would be missing something. There is no compiling time check etc. My question is why do we want to use XM...

what's the point of Dependency Injection Frameworks?

I am sure that I am somewhat lost in this area... my understanding is that Dependency Injection means initializing something that is required by a class..so for instance. If my controller is going to need a service and I want to be able to test it then I should define two Constructor methods for it... so, my question is... why do people ...

Is it possible to override parameter values when using Method Injection with Unity?

Hi there, It says in the Unity manual... ParameterOverride can be used only for constructors. So why are the parameters of methods left out? Cheers, Ian. ...

Using Ninject WCF Extension with WCF Web Service

I have a WCF web service in which I want to use my Repositories and Services which I wish to dependency inject into my WCF web service, however the Ninject WCF Extension example pretty much has a ctor which is instantiating an instance of each dependency, which I don't want, I wanted a purer dependency injection. Has anyone had any succ...

Do repositories have a hidden dependency on the database?

For example, you have an IRepository interface. You also have a SqlRepository class, which implements the interface, backed by a SQL database. Let's say the constructor for that class takes a connection string. If your repository makes stored procedure calls and if those calls are internal to the repository, isn't that a hidden depend...

OpenJPA, Jersey, JUnit: Using a different persistence unit for my unit tests?

Hi all. I'm building an application using OpenJPA 2.0.0, Jersey 1.3, and JUnit 4.8.1. I've set it up so I have two different persistence units defined in my persistence.xml: "default" and "unittest." Default is set up to connect to an Oracle instance, while unittest is set up to connect to a local H2DB embedded database file. I do th...

How to recreate faulted WCF proxies stored within a presenter/controller?

Question regarding patterns involving Model-View-Presenter, IOC and WCF (although I imagine the same would apply to MVC): Working on a large-scale Windows Forms implementation using a MVP (Supervising Controller) pattern plus IOC, where Presenters get their dependencies injected. One common type of dependency is a WCF Client Proxy, crea...

Dealing with relationships and potential inconsistencies with DI / IoC

I'm having trouble designing classes to best make use of DI / IoC principles, particularly when a class shares a dependency with one of its dependencies (ie. X has dependencies Y and Z, and Y has dependency Z). An example will probably be useful: Lets say I have a class that will encapsulate some connection information for my app. Call...

Eclipse - Google Guice

I have been trying to use Google Guice in eclipse plug-in development. I have imported Guice jar as another plug-in project. But somehow Guice is unable to inject dependency. Any ideas??? This is the error message com.google.inject.ConfigurationException: Guice configuration errors: 1) No implementation for java.util.List<java.lang.S...