Autoregistering Func<T>

14 views
Skip to first unread message

RyanL

unread,
Feb 25, 2012, 12:33:27 PM2/25/12
to Castle Project Users
My shop has gotten into the habit of registering most all dependencies
using Func<X> so that instantiation of the objects will occur only
when the object is first called on. Is there any way register all
default interfaces as Func<X> using the fluent interface? Personally
I think the usage of the pattern may be a result of other bad coding
practices (expensive item instantiation?) and maybe I should be trying
to move them away from the pattern. But just thought I'd ask the
question.. if I can do something like below but have my dependencies
resolve as Func<X>?

container.Register(AllTypes.FromThisAssembly()
.InSameNamespaceAs<Program>(true)
.WithService.DefaultInterfaces());

Thanks,
Ryan

Krzysztof Koźmic

unread,
Feb 25, 2012, 8:18:58 PM2/25/12
to castle-pro...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages