Yan Cui
I help clients go faster for less using serverless technologies.
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
Whenever you’re ready, here are 3 ways I can help you:
- Production-Ready Serverless: Join 20+ AWS Heroes & Community Builders and 1000+ other students in levelling up your serverless game. This is your one-stop shop for quickly levelling up your serverless skills.
- I help clients launch product ideas, improve their development processes and upskill their teams. If you’d like to work together, then let’s get in touch.
- Join my community on Discord, ask questions, and join the discussion on all things AWS and Serverless.
nice post. thanks.
Pingback: Castle Windsor Tips — specifying IEnumerable in config file | theburningmonk.com