protected internal WriterInfo GetWriter(ClassMapping mapping, bool append)
{
try
{
switch (_connDesc.Type)
{
case CsvConnectionType.Directory:
case CsvConnectionType.FileName:
return new WriterInfo(GetFileName(mapping), append, UseNamedColumns(mapping));
case CsvConnectionType.Reader:
throw new LoggingException("Connection for class " +
mapping + " was configured as write-only: " + _connDesc.Type);
case CsvConnectionType.Writer:
// We have a writer specifically set.
return new WriterInfo(_connDesc.Writer,
(!_connDesc.HasBeenWrittenTo) && UseNamedColumns(mapping));
default:
throw new LoggingException("Unable to get writer for class " +
mapping + " for unsupported connection type: " + _connDesc.Type);
}
}
catch (Exception e)
{
throw new LoggingException("Unable to get writer for connection " +
_connDesc + ", mapping " + mapping, e);
}
}