WriterFactory refactoring

This commit is contained in:
Sergey Chebotar 2023-05-22 07:31:53 +03:00
parent 0fcc632024
commit dcd42a32eb

View File

@ -11,14 +11,10 @@ public class WriterFactory
public IWriter GetWriter(string writerName)
{
if (writerName.Equals("Dxf"))
return writerName switch
{
return (IWriter)_serviceProvider.GetService(typeof(DxfWriter));
}
else
{
return (IWriter)_serviceProvider.GetService(typeof(ExcelWriter));
}
"Dxf" => (IWriter)_serviceProvider.GetService(typeof(DxfWriter)),
_ => (IWriter)_serviceProvider.GetService(typeof(ExcelWriter))
};
}
}