castle-windsor

Castle Windsor: How to wire up a component to a factory property rather than method

I have the following component public class MyTimer : IMyTimer { public MyTimer(TimeSpan timespan){...} } Where timespan should be provided by the property ISettings.MyTimerFrequency. How do I wire this up in windsor container xml? I thought I could do something like this: <component id="settings" service="MySample.ISettings...

What are "ForwardedTypes" in the context of Castle Windsor component registration?

As the subject says, really! What do they do? ...

Using Castle Windsor's fluent interface to register components in a decorator chain, when there are also specialised service-types?

I am trying to implement a decorator chain for my data-access based on IRepository. I have a Repository that does the data- access (at the moment just in-memory list) {1}, and I have one that does validation {2}. On top of that, I have a specialisation of my Repository, IUsersRepository {3}, which defines another method on the base int...

How to read out/resolve properties from Castle Windsor config

I have a lot of castle xml configs where properties like connectionstring are also held under .Net configuration sections. I'd like to be able to read out the properties using the container but can't see a mechanism to do it. ie <castle> <configuration> <properties> <connectionString>Data Source=MyServer;Initial Catalog=Y...

castle windsor: how to use a Type as constructor property in xml config?

I have the following: TypeUser:ITypeUser { public TypeUser(Type usedType){..} } How do i configure the Type parameter in windsor config xml? ...

C# Proxies and the var keyword

This question is related to a previous post of mine Here. Basically, I want to inject a DAO into an entity i.e. public class User { IUserDAO userDAO; public User() { userDAO = IoCContainer.Resolve<IUserDAO>; } public User(IUserDAO userDAO) { this.userDAO = userDAO; } //Wrapped DAO methods i.e ...

ASP.NET MVC Beta 1: DefaultModelBinder wrongly persists parameter and validation state between unrelated requests

When I use the default model binding to bind form parameters to a complex object which is a parameter to an action, the framework remembers the values passed to the first request, meaning that any subsequent request to that action gets the same data as the first. The parameter values and validation state are persisted between unrelated w...

Castle, AOP and Logging in .NET

Are there any tutorials or sample programs out there on using AOP, Castle, and logging in a .Net application? I have found pieces out there but I am looking for something more to help me form a more complete picture. Thanks, -Brian ...

DI- Dynamic parameter of type Type where type is the parent objects type

Hi guys I have a dependency that I need to inject into one of my classes. This dependency will be lifestyle of Transient. It inturn has a dependency of type Type. This type should be the type of the original class. I was just wondering if anyone has any idea how I might go about conducting this registration. See example: public interfa...

Inject App Settings using Windsor

How can I inject the value of an appSettings entry (from app.config or web.config) into a service using the Windsor container? If I wanted to inject the value of a Windsor property into a service, I would do something like this: <properties> <importantIntegerProperty>666</importantIntegerProperty> </properties> <component id="my...

Where & How Castle Windsor sets up logging facility

Hi guys I'm fairly new to Castle Windsor and am looking into the in's and out's of the logging facility. It seems fairly impressive but the only thing i can't work out is where Windsor sets the Logger property on my classes. As in the following code will set Logger to the nullLogger if the class hasn't been setup yet but when Resolve is...

Problem with Windsor Castle with IIS7

Hi All, I am using windsor DI framework in one of my MVC project. The project works fine when I tried to run from Visual Studio 2008. But when i tried to run the project creating an application in IIS7 then I recieved the following error message: Looks like you forgot to register the http module Castle.MicroKernel.Lifestyle.PerWebReq...

Does Castle Windsor allow the resolution of value types?

I'm trying to pass a parameter into a component that requires a System.TimeSpan. I'm only able to get the 'long ticks' ctor to resolve. Here's a snippet of the config file: <component id="timeInForce" type="System.TimeSpan, mscorlib"> <parameters> <hours>0</hours> <minutes>15</minutes> <seconds>0</seconds> </parameters>...

Does Castle-Windsor support ForwardedTypes via XML configuration

I have a class that implements multiple interfaces. I would like to register these interfaces via XML. All I've found is documentation for the new Fluent Interface. Is this option supported via XML? What would be involved in adding this feature? ...

How to use Castle Windsor with ASP.Net web forms?

I am trying to wire up dependency injection with Windsor to standard asp.net web forms. I think I have achieved this using a HttpModule and a CustomAttribute (code shown below), although the solution seems a little clunky and was wondering if there is a better supported solution out of the box with Windsor? There are several files all s...

IoC Container Applicability / Scenario Demonstration?

A lot of people in the .NET space have picked up Castle Windsor and are implementing it in their projects, and for the past year I've been struggling to figure out why IoC containers seem to be treated as general "best practice"? I've read a LOT of abstracts and brief explanations on the why's of Windsor and the like, but every last one ...

Removing or overwriting a component from Windsor Container

I'm trying to accomplish a seemingly super simple thing: from my unit test I want to replace the type being resolved with a mock/fake object. For example: the xml config states that a component of the service IInterface should resolve to ClassA. That's fine, but from my unit test I want the type to resolve to FakeClassA instead. I can't...

Multiple Interface injection with castle windsor

How can you get castle Windsor to choose the right implantation of a interface at run time when you have multiple implementations in the container. For example lets say i have a simple interface called IExamCalc that does calculations to work out how someone did in that exam. No we have several implementation of this like bellow for ex...

Can Castle Windsor locate files in a subdirectory?

I have a rich client application that uses Castle Windsor. At the moment all the assemblies including the application exe are in the one folder but it all looks rather untidy. I would like to put my dlls inside a subfolder such as "bin" but this prevents Castle from locating types etc when called upon. In fact the app crashes at start up...

nHibernate slow performance on a hosted website

Hi, I have a webapp being hosted with a public hosting company, the site is not live yet, and I am still doing some testing with it. I am using nHibernate with Windsor Castle Container for dependency injection and the site seems to be responding very slow from time to time. I've contacted support but they said that it's my app not their...