Hi, I have what is probably a simple question here about Castle Windsor, which I haven't been using for very long. I'm trying to register a service with a specific instance that will be the singleton implementation of the service.
The container cannot try to create the implementation of the service itself because it has dependencies tha...
I wonder what is the C++ way of using dependency injection? Is that using templates or polymorphic classes? Consider the following code,
class AbstractReader
{
public:
virtual void Read() = 0;
};
class XMLReader : public AbstractReader
{
public:
void Read() { std::cout << "Reading with a XML reader" << std::endl; }
};
class TextF...
Given a View uses a Presenter, and in the presenter you have a model.
How do you inject the model into the presenter? If I was to inject it at the View level, you're back to square one with business logic being in the view - aka the view should not know about its model.
Any advice?
...
I'm working on a simple Java application. Currently, I have two view, one for login in and another once you're logged in.
So my question is, once the user has logged in, should the controller of the login view creates the second view?
The problem is, the first controller needs to know every dependencies of the second view...
Edit : t...
Are there any frameworks out there that allow for data-driven dependency injection (ideally in .NET)? I'm thinking something inspired by Spring.NET for example, where you configure your object graphs in structured database tables, rather than using an XML config file. What would be the pros and cons of configuring your application in t...
I'm trying to figure out what the right patter and usage of log4net is with a dependency injection framework.
Log4Net uses the ILog interface but requires me to call
LogManager.GetLogger(Reflection.MethodBase.GetCurrentMethod().DeclaringType)
in each class or method where I need to log information. This seems to go against IoC prin...
What is an IoC container?
What is an IoC/DI framework?
Why do we need a framework for IoC/DI?
Is there any relationship between IoC/DI and AOP?
What is Spring.net/ninject with respect to IoC and AOP?
...
I am writing a API over the top of a COM object and you have to pass around the COM object into pretty much every type and static method that I write so that I can test each part of my API.
Now my question is do I have an overloaded method for the one that takes the COM object but pass the IoC resolved one instead to the other one inste...
I was reading over Injection by Hand and Ninjection (as well as Why use Ninject ). I encountered two pieces of confusion:
The inject by hand technique I am already familiar with, but I am not familiar with Ninjection, and thus am not sure how the complete program would work. Perhaps it would help to provide a complete program rather ...
I've been using manual constructor injection DI for a little bit now. One thing that I notice is that my constructors are starting to get rather long.
I have a class that depends on a bunch of little objects - anywhere between 6 and 10 sometimes. As I continue to break my application into smaller chunks, I could see this number increa...
In functional programming, functions are regarded as entities, and can be passed around as objects are in an OO context.
At some level, the function may be 'called' with some arguments.
And I was wondering: is this, too, called Dependency Injection?
And further: does this usage of DI result in Inversion of Control?
...
I am using Castle Windsor in my own implementation of the Resolver Pattern. I have two implementations of a service MethodAService and MethodBService that both implement IMethodService. I am using "Convention Over Configuration" when bootstrapping Windsor in. How can I tell Castle Windsor to use always use MethodAService in one instance ...
I am early in development on a new ASP.Net MVC project and I using this project to get into DI. I'm pretty sure that I am going to go with Structure Map, but that isn't what I am asking about. What I am trying to figure out is how best to organize my solution. Do both the unit test project and the model get a configuration file to map th...
Possible Duplicate:
What is dependency injection?
Other developers on my team keep talking about dependency injection. I have looked it up on Wikipedia but I still don't understand exactly what it is or when I would want to use it in my designs. If you have any good examples of when you have used it or when you shouldn't that ...
After going through some tutorials on asp.net mvc the repository pattern came up and the example was with one table, the dinners table. Basically the set up was to create an interface and then a concrete class which implemented the interface and program off the interface in the controller class. The Interface has your typical crud method...
What I would like to know is if there is a technique to inject parameters into the rendering HttpContext such that it would be available to the UserControl when its page life-cycle events (Page_Init, Page_Load) are called during rendering (during HttpContext.Current.Server.Execute())?
Such a technique would allow injecting data into an...
In order to decouple code you can have service locater's but is this not the same as global variables/state?.
I know these often run off interfaces, so you pass in an interface and get a concrete class back but still my question stands.
For example:
class Something {
void DoSomething() {
IMyType myType = ServiceLocator.Ge...
I've been reading about dependency injection and have a simple question. I can understand how via constructor or setter injection required dependencies are autowired by the DI framework. What happens when an object decides it needs to create a new object due to some business process? Do I need to always create a Factory in these situa...
Hi,
I have a asp.net mvc web site where I make use of the Dependency Injections features of the "Micorosoft.Practices.Unity" and "Microsoft.Practices.ObjectBuilder2". This all works great by injected my objects into my controllers constructors.
The problem is that I am having difficulty in clearing this session when a user leaves th...
I'm working on an Spring application which has a large number of beans - in the hundreds - and it's getting quite cumbersome to use and document.
I'm interested in any experience you have with DI-enabled apps with a large number of beans which would aid maintainability, documentation and general usage.
Although the application is Sprin...