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...
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...
I use DependsOn for static dependencies such as connection strings. What is the equivalent function for Unity's Fluent interface?
...
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 ...
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 ...
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...
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...
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 ...
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...
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
{...
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...
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...
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...
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...