RhSolutions-AddIn/RhSolutions.AddIn/Services/ReaderFactory.cs
2023-05-22 07:39:48 +03:00

21 lines
516 B
C#

namespace RhSolutions.Services;
public class ReaderFactory
{
private readonly IServiceProvider _serviceProvider;
public ReaderFactory(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public IReader GetReader(string readerName)
{
return readerName switch
{
"Excel" => (IReader)_serviceProvider.GetService(typeof(ExcelReader)),
_ => (IReader)_serviceProvider.GetService(typeof(ExcelReader))
};
}
}