25 lines
565 B
C#
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));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|