using Microsoft.Extensions.DependencyInjection; namespace InServiceQue.Services; public class QueueTypeRegistry: ITypeRegistry { private static Dictionary _typeRegistry = new Dictionary(); public void RegisterTaskType(string taskType, Type type) { _typeRegistry.Add(taskType, type); } public IQueueHandler GetService(IServiceScope scope, string taskType) { var classType = _typeRegistry[taskType]; var service = scope.ServiceProvider.GetService(classType); return (IQueueHandler)service; } }