I have 2 methods, one of which works with generic param and other one with regular string. It looks like this :
public static async Task PostAlertAsync(this IQueueService queueService,
AlertTypes alertType,
string orgId,
AlertDetailsBase details = null)
{
Guard.ArgumentNotNull(queueService, nameof(queueService));
Guard.ArgumentNotNullOrEmptyString(orgId, nameof(orgId));
var alertMessage = BuildAlertQueueMessage(alertType, orgId, details);
await queueService.SendMessageAsync(alertMessage);
}
public static async Task PostAlertAsync<T>(this IQueueService queueService,
AlertTypes alertType,
T source,
AlertDetailsBase details = null,
string customSubject = null)
where T: IAlertSource
{
Guard.ArgumentNotNull(queueService, nameof(queueService));
Guard.ArgumentNotNull(source, nameof(source));
var alertMessage = BuildAlertQueueMessage<T>(alertType, source, details, customSubject);
await queueService.SendMessageAsync(alertMessage);
}
I wonder, why calling compiling next call result with ambiguity error? String
in this case is obviously doesn't implement IAlertSource
QueueServiceCollection.Alerts.PostAlertAsync(AlertTypes.AzureAdDsProvisionCompleted, orgId);
Any ideas? Thanks.