If you have an interface like this:
IDal<T>
with a concrete class like this, which you want to wire up with Castle:
Dal : IDal<IEntity>
Then here’s the syntax to specify the component in your Castle Windsor configuration file
<component id="myDal"
service="Namespace.IDal`1[[Namespace.IEntity, Assembly]], Assembly"
type="Namespace.Dal, Assembly"/>
Similarly, imagine if you have more than one generic type parameter:
IRetrievable<T, idT> FooRetriever : IRetrievable<Foo, string>
<component id="FooRetriever"
service="Namespace.IRetrievable`2[[Namespace.Foo, Assembly],[System.String]], Assembly"
type="Namespace.FooRetriever, Assembly"/>
Remember, you need to use the back tick (‘), NOT apostrophes (‘)!
References:
StackOverflow question on the syntax to declare generic types in castle config
StackOverflow question on declaring more than one parameter type in castle config




nice post. thanks.
[…] to specify an IEnumerable<T> instance which required taking the technique I showed in this post a little […]