I want to use Unity resolve IService
to two different implementations, to make use of a wrapper class, the equivalent of:
IService service = new
You can use RegisterType overloads that accept string based names. In this case you'll do something like:
container.RegisterType("real");
container.RegisterType("dispatcher");
and announce your dependencies with names as well.
[Dependency("real")]
This will allow you to avoid marker interface which is in most cases is not a good idea.
However if want to keep your code clean from Unity presence (like DependencyAttribute) and in most cases you will use only 1 implementation during application lifetime (for example, only DispatcherService will be used) you basically to make decision whether you need to wrap requested IService with DispatcherService or not. In this case you can look at Static Factory Extension for Unity. Factory delegate will be aware of configuration and based on configuration will either wrap IService with DispatcherService or simply return IService implementation obtained from container.