dependency-injection

Ninject to StructureMap

I am looking to convert following code to StructureMap: private Mock<MembershipProvider> MockMembership = new Mock<MembershipProvider>(); private StandardKernel GetIoCKernel() { var modules = new IModule[] { new InlineModule( new Action<InlineModule>[] { m => m.Bind<MembershipPro...

What to pass via constructor and what to pass via interface?

This is a question about dependency injection. When constructing a service object, we pass in collaborators via the constructor in the construction phase. The service object would implement an interface, and that would be called during the run-phase. Sometimes is is difficult to know if a particular object should be passed via the con...

What is Castle Windsor's DependsOn Equivalent in Unity?

I use DependsOn for static dependencies such as connection strings. What is the equivalent function for Unity's Fluent interface? ...

dependency injection framework Guice vs Spring

I am planning to use dependency injection framework. what should I choose? Guice or Spring? I will use java configuration both ways. also my application is pure java j2se, not web/j2ee application and I don't plan to use spring's rich capabilities. my main concern about guice is that it is much less popular and not in common use. I want ...

Using abstract factory with Spring framework

Hi! I have some Abstract Factory public interface AbstractViewersFactory { IAbstractShapeViewer createRectangle(BaseOperationsListener<RectangleDTO> p); IAbstractShapeViewer createOval(BaseOperationsListener<OvalDTO> p); IAbstractShapeViewer createTriangle(BaseOperationsListener<TriangleDTO> p); } And Its implementation ...

Windsor Interceptor Exception

I have a Windsor container that I'm using an InterceptorSelector and a LazyComponentLoader with. My InterceptorSelector returns an InterceptorReference to my InterceptorAdapter class that looks like this public class InterceptorAdapter<T> : Castle.DynamicProxy.IInterceptor, IOnBehalfAware where T : IMyType { private readonly T int...

WCF Service vs. Referenced Component?

We have a multi services application. We have moved a method that involves a DB access to a separate component that is exposed by a WCF endpoint. We have more than one service that need to use this method. The dilemma is what to use: A WCF call to the method. Call directly to the method, resolved by our DI engine. The system perfor...

EJB3 JSF application run in jboss 5

I am using JSF 1.2, EJB 3 on JBoss 5. This is my EJB: @Local public interface HelloServiceLocal { public void sayHello(String username); } @Stateless(name="helloService") public class HelloService implements HelloServiceLocal { public void sayHello(String username) { // business logic } } In a JSF backing bean ...

Object factory which Creates objects that require dependencies

Currently in code i have used an object factory to return me a processor based of a string tag, which has severed its purpose up until now. using Core; using Data; public static class TagProcessorFactory { public static ITagProcessor GetProcessor(string tag) { switch (tag) { case "gps0": return new GpsTagProce...

Dependency injection - is there an alternative to this very large constructor ?

Shortly i decided to go for the Dependency Injection technique for a new PHP application i am about to write. However, I am not entirely sure i understand it enough. My problem is, the baseClass has a dependency on various items, while a lot of different classes will need to extend it. For example: namespace system; class baseClass {...

Ninject, how to inject an object living in the session into my business class?

I have a profile object in session with profile information for the currently logged in user. I wand to be able to inject it into my business classes so I can do validation etc in them without having to pass it in the parameter list in every method. I have tried something like this in my ninject module: Profile profile = HttpContext.C...

Minimum JARs for Spring 3.0 dependency injection

Similarly to this question regarding an earlier Spring version, what are the minimum dependencies required for an application to use Spring 3.0 dependency injection only? The application context will be configured by XML only. Spring depends on a logging framework, so assume I already include these JARs for logging: jcl-over-slf4j.ja...

Tell C# to use Castle to create objects

Hi! I think my question is a long shot. Lets say I have an attribute: public sealed class MyCustomAttribute: ActionFilterAttribute Used on a class method [MyCustomAttribute] public virtual ActionResult Options(FormCollection collection) Now, I need to add a contructor's parameter public MyCustomAttribute(IMyDependent...

Dependency Injection and code maintainability

I am working on a (vb.net/asp.net) project that is using interfaces to provide dependency injection. But to me, it feels like the maintainability of the code has been killed. When I want to read through the code, I can't simply jump to the code of a related class that is used. All I see are the interfaces, and so I have to hunt through t...