Первый проект использует Autofac для внедрения зависимостей, другой использует Microsoft.Extensions.DependencyInjection
Первый рабочий объект выглядит так :
Код: Выделить всё
public class Worker : BackgroundService
{
...
public Worker(
[KeyFilter(ChannelKeys.Name1)]
Channel dataChannel1,
[KeyFilter(ChannelKeys.Name2)]
Channel dataChannel2,
...
)
}
Код: Выделить всё
public Worker(
[FromKeyedServices(ChannelKeys.Name1)]
Channel dataChannel1,
[FromKeyedServices(ChannelKeys.Name2)]
Channel dataChannel2,
...
Подробнее здесь: https://stackoverflow.com/questions/787 ... dependency