castle-windsor

Custom lifetime management in DI containers (wcf proxy: Unity vs Castle Windsor)

Hello, I've found nice post: Singleton WCF Proxy. It is about the implementation of WCF proxy life scope using Castle Windsor DI container. Implementation of the abstract class AbstractLifestyleManager from Castle.MicroKernel.Lifestyle namespace overrides 3 methods: Resolve, Dispose and Release. In the Release method we have access ...

asp.net mvc test project cannot find windsor file

Hi there Im using windsor as a DI container, my code is below public static class ContainerBuilder { public static IWindsorContainer Build() { var container = new WindsorContainer("Configuration\\Windsor.config"); // automatically register controllers container.Register(AllTyp...

How can Windsor create one component for each resolve invocation?

Consider the following classes: public interface IView { /// <summary> /// Ignore this (its only for the assertion) /// </summary> ITask Task { get; } } public class ViewA : IView { private readonly ITask _task; public ViewA(ITask task) { _task = task; } public ITask Task { get ...

Windsor: Am I completely misunderstanding how child containers work?

Can someone please explain why this test fails: [Fact] public void ResolveAllDoesNotReturnServicesRegisteredInParent() { // arrange var windsorContainer = new WindsorContainer(); windsorContainer.Register(Component.For<IView>().ImplementedBy<ViewA>().LifeStyle.Transient); windsorContainer.Reg...

Proper use of Windsor container inside ASP.Net / ASP.Net MvC

For a new project i am using the Windsor container to provide Dependency Injection (DI). DI should provide me with loose coupling and high testability. Since i am new to the subject of dependency injection i am having trouble wrapping my head around how to use it properly. This is what i learned for articles and googling: You should hav...

Castle Windsor & NHibernate facility: Value cannot be null. Parameter name: classType

Hi I am attempting to use Castle windsor Nhibernate Facility with fluent Nhibernate and Im getting the error above, as far as Im aware , I have followed the instructions on setting this up. Has anyone else seen this issue and maybe offer some advice? Thanks Value cannot be null. Parameter name: classType Description: An unhandled except...

Injecting a dependency into a static class

What configuration do I need to setup a static property dependency using Windsor container? I have the following class at the moment and I would like the Logger property to be injected. static class StuffDooer { static ILogger Logger { get; set; } static StuffDooer() { Logger = NullLogger.Instance; } } Here's my configuration ...

Prevent methods from being intercepted - castle

Hi All When I assign an interceptor to the component when registering it (interface based), every method that is part of the interface contract gets intercepted. Is there a way prevent a method from being intercepted an attribute or something? Thanks ...

Castle Windsor with XML includes, customization problem

Hi, I use Castle Windsor which is pure awesomeness :) I wire the system via XML but I have one little problem I wan't ask here. I have my core system which has it's registrations, works great so far. Then my problem arises with our customizations of the core system. Eg. - I wan't to change one implementation for another. - Add some...

Castle.MicroKernel.ComponentNotFoundException : No component for supporting the service Castle.Services.Transaction.ITransactionManager was found

Hi I am using Castle with the Nhibernate Integration Faclility I am running a few tests and they are failing with the error at Castle.MicroKernel.DefaultKernel.get_Item(Type service) at Castle.Facilities.NHibernateIntegration.DefaultSessionManager.ObtainCurrentTransaction() at Castle.Facilities.NHibernateIntegration.DefaultSessionManag...

Tips for fixing dll version problems in .NET.

Hi all I've just got to grips with the basics of NHibernate, and while refactoring my data access and domain layers I thought I might as well get cute and start using dependency injection for the data access layer. Unit testing here we come! I thought since NHibernate uses loads of Castle dlls I might as well use Castle Windsor for th...

ASP.NET MVC controllers in separate assembies and Castle Windsor

I need to find a way to put my MVC controllers into a different project from the MVC project. I think I'm close. I've setup the Castle Windsor IoC container, and have my controllers in a different project. I think it's hanging up on the Web.Config. Is there a component I need to add? Here is the current exception I'm getting: No com...

Castle Windsor the default constructor is called instead of the constructor with a dependency.

Given the following Code. [TestMethod] public void CanResolveILoggerTest() { var Container = new Castle.Windsor.WindsorContainer(); Container.Register( Component.For<Castle.Core.Logging.ILogger>() .ImplementedBy<Castle.Core.Logging.TraceLogger>(), Component.For<NeedsLogger>...

Windsor Castle resolve Dictionary<> failed

I did the following: container.Register(Component.For<Dictionary<string, string>>() .Instance(ServiceDictionaryInstance) .Named("serviceDictionary")); The class consumes the component is: public class BusinessService : IDecisionFilter { private readonly Dictionary<str...

Can I eagerly instantiate instances registered as singletons using castle windsor?

In castle windsor, when registering instances with a singleton lifecycle, is there a way to eagerly instantiate them (rather then having them initialized the first time they are injected)? Update: I figured some more details would be helpful here: These instances contain some initialization code that would be advantageous to run at s...

Castle Windsor Problem

{"Configuration system failed to initialize"} i get this error while trying to run a windows application i made ,which means that castle windsor couldnt initialize the configuration from the app.config the funny thing is my test project works and its able to initialize the same app.config but when i moved that to windows application an...

Castle Windsor - Do I have to release singleton or non-disposable transient objects?

The Castle wiki says at several places I should ALWAYS call container.Release() for components resolved through the container. This obviously makes sense for sophisticated life-style management techniques (e.g. LifeStyle.Pooled) or when using specialized facilities... But do I really have to release singleton (which live until the conta...

How can I get action name?

Hi folks, I replaced the ASP.NET ControllerFactory by a WindsorControllerFactory. And I registered all controllers and interceptors. Until here everything working well. Now when I am debuging my Interceptor I always get Execute from ControllerBase in invocation.Method.Name. I need to get the action name and the parameters of the acti...

How can I use Castle's RemotingFacility to access two different endpoints from the client?

I have a web application that communicates with multiple .net remoting endpoints. I'd like to use the Castle RemotingFacility to resolve my remote dependencies, but it looks like you can only configure one endpoint uri for the facility. Is this scenario possible with the existing RemotingFacility? If so, how? Thanks. ...

What is a correct approach to register several inctances for the same type in Windsor Container?

I am using CommonSrviceLocator with WindworContainer for resolving my NHibernage.ISession instances. ISession instances is created through SessionFactory. For some reason I need to work with different databases in one application, so I need different connection strings and different NHibernate.ISession objects. SessionFactory can create...