C# Class SampleAppendersApp.Appender.FastDbAppender

Simple database appender

This database appender is very simple and does not support a configurable data schema. The schema supported is hardcoded into the appender. Also by not extending the AppenderSkeleton base class this appender avoids the serializable locking that it enforces.

This appender can be subclassed to change the database connection type, or the database schema supported.

To change the database connection type the GetConnection method must be overridden.

To change the database schema supported by the appender the InitializeCommand and SetCommandValues methods must be overridden.

Inheritance: IAppender, IBulkAppender, IOptionHandler
ファイルを表示 Open project: aurora-sim/Aurora-Libs

Public Methods

Method Description
ActivateOptions ( ) : void
Close ( ) : void
DoAppend ( log4net.Core.LoggingEvent loggingEvent ) : void

Protected Methods

Method Description
GetConnection ( ) : IDbConnection

Create the connection object

This implementation returns a SqlConnection. To change the connection subclass this appender and return a different connection type.

InitializeCommand ( IDbCommand command ) : void

Initialize the command object supplied

This method must setup the database command and the parameters.

SetCommandValues ( IDbCommand command, log4net.Core.LoggingEvent loggingEvent ) : void

Set the values for the command parameters

Set the values of the parameters created by the InitializeCommand method.

Method Details

ActivateOptions() public method

public ActivateOptions ( ) : void
return void

Close() public method

public Close ( ) : void
return void

DoAppend() public method

public DoAppend ( log4net.Core.LoggingEvent loggingEvent ) : void
loggingEvent log4net.Core.LoggingEvent
return void

GetConnection() protected method

Create the connection object

This implementation returns a SqlConnection. To change the connection subclass this appender and return a different connection type.

protected GetConnection ( ) : IDbConnection
return IDbConnection

InitializeCommand() protected method

Initialize the command object supplied

This method must setup the database command and the parameters.

protected InitializeCommand ( IDbCommand command ) : void
command IDbCommand the command to initialize
return void

SetCommandValues() protected method

Set the values for the command parameters

Set the values of the parameters created by the InitializeCommand method.

protected SetCommandValues ( IDbCommand command, log4net.Core.LoggingEvent loggingEvent ) : void
command IDbCommand the command to update
loggingEvent log4net.Core.LoggingEvent the current logging event to retrieve the values from
return void