I am experiencing an issue with v1 of Ninject and resetting the StandardKernel. I have a static object that I use to provide access to the kernel like so
public static class ObjectFactory
{
private static IKernel _kernel = new StandardKernel(new CanceisModule());
// Resolve methods snipped for brevity
public static void ...
I have a couple of method attributes which do some logging. Our logging code sits behind an interface (ILog) and I'd like it if the attributes were only dependent upon that interface as opposed to an implementation. This isn't really about testability or dependency inversion so much as it is about keeping the coupling of components clean...
I have created an ASP.NET MVC application and am trying to use Castle Windsor as my IOC
However, when the controllers are trying to resolve I am getting 'Content' and 'Scripts' into the 'controllerName' parameter in the CreateController(RequestContext requestContext, string controllerName) method. Needless to say these are not controlle...
I'm in the process of trying to hook StructureMap in to an existing webforms application.
Since it's webforms I have to use Setter Injection, which is not ideal, but it's better than nothing.
Where I'm coming unstuck is translating to VB (I'm really a C# dev currently working in a VB shop). I've written a custom scanner, which works fin...
I have an C# dll project for which I have to store the runtime settings in an external XML file, and this dll will be used in an ASP.NET/ASP.NET MVC application for which I also have to store the runtime settings in a external file.
Which IoC container can be used to create an object with the runtime settings loaded from a specific exte...
Is it possible to build something that works like an ISubDependencyResolver but also supports Release(...)?
I have a situation where I want to be able to resolve a derived class of Fruit in the constructor of a Blender:
abstract class Fruit
{
}
class AppleBlender
{
AppleBlender(Apple a)
{
}
}
Apple is unfortunately in a ...
I've recently started using an IoC container for the first time, but I'm not educated on the best practices for using it. More specificaly I'm using Unity in a C# .NET project, and I started using it because it came with Prism.
I use the container to resolve the "top level" objects, and they get the correct objects injected based on the...
StructureMap has the ability to apply conventions when scanning. Thus IFoo => Foo, without explicit registration.
Is something simular available in AutoFac? Looked around and just can't find anything helpfull.
Thanks,
...
I have a a model class that needs access to my repository class (used for DB access).
I have created an interface for my repository and have successfully configured Castle Windsor to inject my the appropriate IRepository-based class into my controllers via a custom ControllerFactory.
I'm having a little more trouble figuring out how to...
I would like to inject a dependency into an ASP.NET MVC model, but I can't figure out where in the pipeline to do the injection.
It's very straightforward with a ControllerFactory, but not nearly as much when dealing with models.
...
I'm looking for some guidance about how to chose an IoC container for an ASP.NET MVC application.
What are the differences between (for example) StructureMap, Ninject, Castle Windsor, Unity, autofac and others? Can anyone give some hints or links to resource that might help chosing one library?
Update: there is one question (http://sta...
I am using Dependency Injection in my code (with Ninject) and thought I was doing quite well until I came across a performance problem that was caused by a misunderstanding of where DI containers fit into your code. There seems to be a lot of information on how to use DI frameworks but not too much on where not to use them or how best t...
IoC Frameworks just make DI much easier, but it's not only DI that they do, they provide a host of other benefits over and above DI.
I saw this comment in one of the answers to a question about DI and IoC. Can someone explain this in some more details? What are other benefits of IoC?
...
Hello,
I am using Castle.Windsor as an IOC.
So I am trying to resolve a service type in the constructor of an HTTPHandler. I keep receiving this error, "Constructor on type: "Namespace.type" not found." My configuration has the following entries for service type: IDocumentDirectory
<component id="restricted.content.directory" service=...
Hi all,
Is it true that in order for castle windsor's interceptor to intercept a method, that method needs to be declare public?
...
Why doesn't DoIt() method call get intercepted? Should I use something other than InterfaceInterceptor to intercept the DoIt() method? How would you do it?
using System;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.InterceptionExtension;
namespace UnityTest
{
class Program
{
static void Main(string[] ar...
I am trying to register a type like IRequestHandler1[GenericTestRequest1[T]] which will be implemented by GenericTestRequestHandler`1[T] but I am currently getting an error from Windsor "Castle.MicroKernel.ComponentNotFoundException : No component for supporting the service " Is this type of operation supported? Or is it to far removed ...
I've just finished converting a large amount of legacy code to use NHibernate. The next thing I want to do is introduce an IOC container for hooking up the data access layer repositories and other such things. There are a variety of options out there at the moment - Castle Windsor, StructureMap, NInject, Unity etc; the choice is difficul...
I'm just starting with Windsor, so please be gentle :) I have a scenario where I want to be able to override/replace components placed inside a windsor container. Read on ...
In my prod code, I want to be able to register a component which implements a base class, and use a container to resolve the implementer. So far, using
container...
What is the required IOC instance lifecycle I need to use in conjuction with a NServiceBus message handler if I want an instance per message handled.
PerRequest won't work, since given the numerous constructor dependenices and dependency graph I have, it gives me many instances when I require only one per Handle(MessageX msg) call. I ca...