zcz527 / autofac

Automatically exported from code.google.com/p/autofac
Other
0 stars 0 forks source link

Add Named extension method which takes a func for the type. #302

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If you currently use RegisterAssemblyTypes and want to bind the closed generic 
type of the type to an named parameter you have a problem since you dose not 
know that type at this point.

So my guess would be to add an extension method which can do that:

builder.RegisterAssemblyTypes(GetType().Assembly)
  .Named("closed",t=>t.GetInterfaces()[0]);

Original issue reported on code.google.com by lanwin...@gmail.com on 28 Feb 2011 at 11:02

GoogleCodeExporter commented 8 years ago
Hi,

RegisterAssemblyTypes() doesn't support generic types at this stage. There's an 
item in the tracker for it (215), but differences like the one you've pointed 
out discourage us from going down that path.

When we look at 215 we'll have to consider the current issue so I'll merge them.

Thanks,
Nick

Original comment by nicholas...@gmail.com on 9 Mar 2011 at 9:10