@@ -52,9 +52,14 @@ public MSSqlServerSinkTraits(string connectionString, string tableName, string s
52
52
FormatProvider = formatProvider ;
53
53
54
54
ExcludedColumnNames = new List < string > ( ColumnOptions . Store . Count + 1 ) ;
55
- ExcludedColumnNames . Add ( "id" ) ;
56
- foreach ( var column in ColumnOptions . Store )
57
- ExcludedColumnNames . Add ( column . ToString ( ) ) ;
55
+ ExcludedColumnNames . Add ( ColumnOptions . Id . ColumnName ?? "Id" ) ;
56
+ if ( ColumnOptions . Store . Contains ( StandardColumn . Message ) ) ExcludedColumnNames . Add ( ColumnOptions . Message . ColumnName ?? "Message" ) ;
57
+ if ( ColumnOptions . Store . Contains ( StandardColumn . MessageTemplate ) ) ExcludedColumnNames . Add ( ColumnOptions . MessageTemplate . ColumnName ?? "MessageTemplate" ) ;
58
+ if ( ColumnOptions . Store . Contains ( StandardColumn . Level ) ) ExcludedColumnNames . Add ( ColumnOptions . Level . ColumnName ?? "Level" ) ;
59
+ if ( ColumnOptions . Store . Contains ( StandardColumn . TimeStamp ) ) ExcludedColumnNames . Add ( ColumnOptions . TimeStamp . ColumnName ?? "TimeStamp" ) ;
60
+ if ( ColumnOptions . Store . Contains ( StandardColumn . Exception ) ) ExcludedColumnNames . Add ( ColumnOptions . Exception . ColumnName ?? "Exception" ) ;
61
+ if ( ColumnOptions . Store . Contains ( StandardColumn . Properties ) ) ExcludedColumnNames . Add ( ColumnOptions . Properties . ColumnName ?? "Properties" ) ;
62
+ if ( ColumnOptions . Store . Contains ( StandardColumn . LogEvent ) ) ExcludedColumnNames . Add ( ColumnOptions . LogEvent . ColumnName ?? "LogEvent" ) ;
58
63
59
64
if ( ColumnOptions . AdditionalDataColumns != null )
60
65
AdditionalDataColumnNames = new HashSet < string > ( ColumnOptions . AdditionalDataColumns . Select ( c => c . ColumnName ) , StringComparer . OrdinalIgnoreCase ) ;
@@ -114,7 +119,7 @@ private KeyValuePair<string, object> GetStandardColumnNameAndValue(StandardColum
114
119
case StandardColumn . Level :
115
120
return new KeyValuePair < string , object > ( ColumnOptions . Level . ColumnName ?? "Level" , ColumnOptions . Level . StoreAsEnum ? ( object ) logEvent . Level : logEvent . Level . ToString ( ) ) ;
116
121
case StandardColumn . TimeStamp :
117
- return new KeyValuePair < string , object > ( ColumnOptions . TimeStamp . ColumnName ?? "TimeStamp" , ColumnOptions . TimeStamp . ConvertToUtc ? logEvent . Timestamp . ToUniversalTime ( ) : logEvent . Timestamp . DateTime ) ;
122
+ return new KeyValuePair < string , object > ( ColumnOptions . TimeStamp . ColumnName ?? "TimeStamp" , ColumnOptions . TimeStamp . ConvertToUtc ? logEvent . Timestamp . ToUniversalTime ( ) . DateTime : logEvent . Timestamp . DateTime ) ;
118
123
case StandardColumn . Exception :
119
124
return new KeyValuePair < string , object > ( ColumnOptions . Exception . ColumnName ?? "Exception" , logEvent . Exception != null ? logEvent . Exception . ToString ( ) : null ) ;
120
125
case StandardColumn . Properties :
0 commit comments