A Wider Way of Type Registration and Injection

Jan 9, 2009 at 11:24 AM
I was looking at the Policy concept used for the Interception and I thought i should ask this about Injection:

I basically don't want to have to specify every single type and/or its interface for registration.
I want a way to say that I want "all types matching this pattern" to be registered. Period. These patterns could be very similar to the Interception Matching Rules.
Can I do that? Or do we need another layer of simplification on top of Unity (say Serenity or Liberty ... just joking)?
In a pseudo-code style, the configuration would look like:

container.Configure<

InjectedMembers>()
    .AddPolicy(
"AllServices")
        .AddMatchingRule(
new MemberNameMatchingRule("Do*", true))
        .AddInjection(
new InjectionParameter(typeof(Transaction), new Transaction())
.InjectedMembers
    .AddPolicy(
"All DAOs")
        .AddMatchingRule(
new AssemblyMatchingRule("MyDaoAssembly"))
        .AddInjection(
new InjectionConstructor("Some Connection String"))
        .AddInjection(
new InjectionProperty("Logger", someLogger));

 

Jan 13, 2009 at 2:54 AM
Refer to this thread... http://www.codeplex.com/unity/Thread/View.aspx?ThreadId=43766

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@avanade.com