zcz527 / autofac

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

Composite pattern #297

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I noticed I quite often need to implement composite pattern. For example:

interface IService { ... }
class Service1 : IService { ... }
class Service2 : IService { ... }
class CompositeService : IService
{
    public CompositeService(IEnumerable<IService> services) { ... }
    ...
}

I want to register CompositeService as IService in container and have 
dependencies injected.

(looks somewhat similar to Decorator but decorating set of services instead of 
only one)

What's the best way to do it in autofac?

Original issue reported on code.google.com by Konst...@gmail.com on 22 Feb 2011 at 5:16

GoogleCodeExporter commented 8 years ago
Thanks for getting in touch. This issue tracker is for bug reports and 
enhancement requests only - please post your question to Stack Overflow with 
the 'autofac' tag, we will make every effort to get you on the right track. 
Cheers!

Original comment by nicholas...@gmail.com on 23 Feb 2011 at 10:02

GoogleCodeExporter commented 8 years ago
Thanks!
I've posted question 
http://stackoverflow.com/questions/5092602/autofac-composite-pattern

Original comment by Konst...@gmail.com on 23 Feb 2011 at 3:03