RhSolutions-AddIn/RhSolutions.AddIn/Services/WriterFactory.cs
2023-04-17 08:49:26 +03:00

25 lines
565 B
C#

namespace RhSolutions.Services;
public class WriterFactory
{
private readonly IServiceProvider _serviceProvider;
public WriterFactory(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public IExcelWriter GetWriter(string writerName)
{
if (writerName.Equals("Dxf"))
{
return (IExcelWriter)_serviceProvider.GetService(typeof(RhDxfWriter));
}
else
{
return (IExcelWriter)_serviceProvider.GetService(typeof(RhExcelWriter));
}
}
}