I am always struggling with decoration + interfaces. Say I have the following \'behavior\' interfaces :
interface IFlyable { void Fly();}
interface ISwimmable {
You will need to create separate decorators for each interface. An alternative is to use a generic interface for your services and a generic decorator. For example:
public interface ICommandService
{
Task Execute(TCommand command);
}
public class LoggingCommandService : ICommandService
{
public LoggingCommandService(ICommandService command, ILogger logger)
{
...
}
public async Task Execute(TCommand command)
{
// log
await this.command.Execute(command);
// log
}
}