castle-windsor

Problem creating WCF service with Windsor

Does anyone know how to configure WCF using Windsor on IIS 7.0? I'm using the latest from WCF Windsor facility trunk and Windsor 2.1.1. The example on http://www.castleproject.org/container/facilities/trunk/wcf/index.html is out of date. Even demo project in WCF facility doesn't mention how to setup WCF service in IIS using the config an...

Intercept Properties With Castle Windsor IInterceptor

Does anyone have a suggestion on a better way to intercept a properties with Castle DynamicProxy? Specifcally, I need the PropertyInfo that I'm intercepting, but it's not directly on the IInvocation, so what I do is: public static PropertyInfo GetProperty(this MethodInfo method) { bool takesArg = method.GetParameters...

Windsor OnCreated for all components

Hi, How would I go about globally intercepting the creation/resolution of all instances by my container? I know I can do this individually with OnCreated on a per-component basis, but I want to do this globally for all objects resolved by the container. Thanks. ...

Castle Windsor upgrade causes TypeLoadException for generic types

I have the following mapping in my Castle Windsor xml file which has worked okay (unchanged) for some time: <component id="defaultBasicRepository" service="MyApp.Models.Repositories.IBasicRepository`1, MyApp.Models" type="MyApp.Models.Repositories.Linq.BasicRepository`1, MyApp.Models" lifestyle="perWebRe...

IComponentActivator Instance

How can I use an IComponentActivator instance for a component, not just specifying a type. That is, instead of Component.For<XYZ>.Activator<MyComponentActivator>(); I want to be able say Component.For<XYZ>.Activator(new MyComponentActivator(someImportantRuntimeInfo)); Also, is there a way I can choose an activator dynamically fo...

Windsor: How can I specify Inspectionbehaviour.None so than Castle won't autoresolve properties fluently?

I see that i can specify this behavior in xml by using the following: <component id="notification" service="Acme.Crm.Services.INotificationService, Acme.Crm" type="Acme.Crm.Services.EmailNotificationService, Acme.Crm" inspectionBehavior="none"> </component> But how do I do this using fluent registration? ...

Windsor: How can I make windsor dispose a transient component when not tracking component lifecycle?

We are using the NoTrackingReleasePolicy on the Windsor container due to the memory leaks that occur when we do not Release our components after usage. Now consider the following problem. Some disposable component: public class DisposableComponent : IDisposable { private bool _disposed; public bool Disposed { get {...

Windsor: How do I tell the container to release DynamicParameters when releasing the component?

windsorContainer.Register( Component.For<ClassWithReferenceToDisposableService>() .LifeStyle.Transient .DynamicParameters((k, d) => { d["disposableComponent"] = ...

Event Interception with Castle DynamicProxy

Hi, In googling I can't seem to find an example of intercepting event on a proxied type and it doesn't seem to be working for me. Is there a way I can do this (ie. use an IInterceptor when an event is invoked)? Thanks. ...

castle scheduler - cluster

Hi We're using the castle scheduler component: http://using.castleproject.org/display/Comp/Castle.Components.Scheduler?showChildren=false I have a wcf service which creates the tasks and that does it's job fine. I then have a console app running (will be a windows service eventually) which should then keep an eye out for tasks to run....

Problem Registering a Generic Repository with Windsor IoC

I’m fairly new to IoC and perhaps my understanding of generics and inheritance is not strong enough for what I’m trying to do. You might find this to be a mess. I have a generic Repository<TEntity> base class: public class Repository<TEntity> where TEntity : class, IEntity { private Table<TEntity> EntityTable; private st...

Use component id in Castle Windsor generic object configuration

2 questions in one, but very much related. Is it possible with Castle Windsor to resolve a configuration entry such as - Assembly.Namespace.Object1`2[[${ComponentId1}],[${ComponentId2}]], Assembly Where ComponentId1 and ComponentId2 are defined as components. Castle Windsor doesn't seem to be resolving the ComponentId, it is just look...

Castle Windsor using wrong component to satisfy a dependency

I have the following component mapping in Windsor xml: <component id="dataSession.DbConnection" service="System.Data.IDbConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" type="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e08...

Check for Windsor Container Component Instance

How can I use my Windsor container to check if an instance (not just a component) has been registered? ie. container.ContainsInstance(typeof(MyType)) [EDIT] Another way of writing this might be Kernel.GetAssignableHandlers(typeof(object)) .Where(handler => handler.Service == typeof(MyType) || handler.ComponentModel.Implementa...

How do I pass dependency to object with Castle Windsor and MS Test?

I am trying to use Castle Windsor with MS Test. The test class only seems to use the default constructor. How do I configure Castle to resolve the service in the constructor? Here is the Test Class' constructors: private readonly IWebBrowser _browser; public DepressionSummaryTests() { } public Depress...

Windsor PerWebRequest resolution in Application_Start

I am injecting HttpContextBase into a caching class. HttpContextBase is registered as PerWebRequest. I interact with the caching class on each web request and this works fine, but I also need to initialise the cache at application start. I understand that PerWebRequest does not work in Application_Start though: http://stackoverflow.com...

Can't Instantiate Windsor Custom Component Activator

Hi, I'm getting an exception calling Resolve: KernelException: Could not instantiate custom activator Inner Exception: {"Constructor on type 'MyProj.MyAdapter`1[[MyProj.MyBusinessObject, MyAsm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' not found."} There's definitely a public parameterless constructor there (and I've v...

Good book on Castle Project?

Does anyone know of a good book on the Castle Project? I'm interested in learning more about any of the Castle projects (ActiveRecord, MonoRail, Windsor, anything!) and searches for Castle on Amazon are a little frustrating with the need to weed out all the fiction and nonsense. ...

Castle Windsor - Resolving a generic implementation to a base type

I'm trying to use Windsor as a factory to provide specification implementations based on subtypes of XAbstractBase (an abstract message base class in my case). I have code like the following: public abstract class XAbstractBase { } public class YImplementation : XAbstractBase { } public class ZImplementation : XAbstractBase { } public...

Where is the tag in the Windsor Castle Repository for targeting .Net 2.0?

I can't seem to see it... ...