File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
src/Serilog.Sinks.MSSqlServer/Sinks/MSSqlServer Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ namespace Serilog.Sinks.MSSqlServer
26
26
/// Writes log events as rows in a table of MSSqlServer database using Audit logic, meaning that each row is synchronously committed
27
27
/// and any errors that occur are propagated to the caller.
28
28
/// </summary>
29
- public class MSSqlServerAuditSink : ILogEventSink
29
+ public class MSSqlServerAuditSink : ILogEventSink , IDisposable
30
30
{
31
31
private readonly ISqlLogEventWriter _sqlLogEventWriter ;
32
32
@@ -97,6 +97,25 @@ internal MSSqlServerAuditSink(
97
97
public void Emit ( LogEvent logEvent ) =>
98
98
_sqlLogEventWriter . WriteEvent ( logEvent ) ;
99
99
100
+ /// <summary>
101
+ /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
102
+ /// </summary>
103
+ public void Dispose ( )
104
+ {
105
+ Dispose ( true ) ;
106
+ GC . SuppressFinalize ( this ) ;
107
+ }
108
+
109
+ /// <summary>
110
+ /// Releases the unmanaged resources used by the Serilog.Sinks.MSSqlServer.MSSqlServerAuditSink and optionally
111
+ /// releases the managed resources.
112
+ /// </summary>
113
+ /// <param name="disposing">True to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
114
+ protected virtual void Dispose ( bool disposing )
115
+ {
116
+ // This class needn't to dispose anything. This is just here for sink interface compatibility.
117
+ }
118
+
100
119
private static void ValidateParameters ( MSSqlServerSinkOptions sinkOptions , ColumnOptions columnOptions )
101
120
{
102
121
if ( sinkOptions ? . TableName == null )
You can’t perform that action at this time.
0 commit comments