A service can only be registered for one interface

Topics: CAB & Smart Client Software Factory
Jun 8, 2006 at 10:54 AM
originally posted by: yysun

Having one concrete service class that implements more than one interfaces
When adding Service attribute, only one is allowed.

public class MyService : IMyService1, IMyService2, IMyService3

The above three attributes are not allowed. Can only use

public class MyService : IMyService1, IMyService2, IMyService3

And when using the service, it is impossible to inject by interface type

public partial class MyView
private IMyService1 service = null;

ServiceDependency(Required = true, Type = typeof(IMyService1))
public IMyService1 Service
set { service = value; }

Need to use

ServiceDependency(Required = true, Type = typeof(MyService))

Is this a thing CAB team consider to be changed?
Jun 9, 2006 at 12:12 AM
originally posted by: hmoeller

I cannot see the point in not allowing multiple Service attributes also. Maybe it's a matter of implementation only? Shouldn't be too hard to extent the existing implementation.

In the meantime, you should be able to register the services manually by calling WorkItem.Services.Add().