DependencyInjection.Attributed
DependencyInjection.Attributed copied to clipboard
Add support for keyed service with multiple attributes
Hi,
I'd like to be able to specify the attribute several times in the case of keyed service. Is this possible? At the moment, error ‘CS0579’ is being thrown.
public interface INotificationService
{
string Notify(string message);
}
[Service<string>("sms")]
public class SmsNotificationService : INotificationService
{
public string Notify(string message) => $"[SMS] {message}";
}
[Service<string>("email")]
[Service<string>("default")]
public class EmailNotificationService : INotificationService
{
public string Notify(string message) => $"[Email] {message}";
}
