Auto Add Service for interfaces

Topics: CAB & Smart Client Software Factory
Jul 5, 2005 at 3:40 PM
originally posted by: FrancoisTanguay

interface IFooService, interface IBarService

class MyService : WorkItem, IFooService, IBarService
public void Func(){}

It would have been nice that MyService could have automatically published 3 services {MyService, IFooService, IBarService} wihtout the need to explicitly call AddService(...).
Jul 6, 2005 at 6:08 AM
originally posted by: BradWilsonMSFT

What would the expected behavior be when two services implement the same interface?
Jul 6, 2005 at 6:32 AM
originally posted by: FrancoisTanguay

Not sure what you mean...

Do you mean when two services that implement the same interface would try to promote their services to the same parent?

interface IService
Foo : WorkItem, IService // Automatically adds IService and promote it to parent
Bar : WorkItem, IService // Same
Zaz : WorkItem
Zaz.WorkItems.Add(new Foo())
Zaz.WorkItems.Add(new Bar())

Then I'd probably throw on the second Add. Or I'd allow some overrides to allow to choose which interfaces to automatically add, ...

But again, not sure what you meant.