Table of Contents

Class AdoNetAppenderParameter

Namespace
log4net.Appender
Assembly
log4net.dll

Parameter type used by the AdoNetAppender.

public class AdoNetAppenderParameter
Inheritance
AdoNetAppenderParameter
Inherited Members

Remarks

This class provides the basic database parameter properties as defined by the IDbDataParameter interface.

This type can be subclassed to provide database specific functionality. The two methods that are called externally are Prepare(IDbCommand) and FormatValue(IDbCommand, LoggingEvent).

Constructors

AdoNetAppenderParameter()

Initializes a new instance of the AdoNetAppenderParameter class.

public AdoNetAppenderParameter()

Remarks

Default constructor for the AdoNetAppenderParameter class.

Properties

DbType

Gets or sets the database type for this parameter.

public DbType DbType { get; set; }

Property Value

DbType

The database type for this parameter.

Remarks

The database type for this parameter. This property should be set to the database type from the DbType enumeration. See DbType.

This property is optional. If not specified the ADO.NET provider will attempt to infer the type from the value.

See Also

Layout

Gets or sets the IRawLayout to use to render the logging event into an object for this parameter.

public IRawLayout Layout { get; set; }

Property Value

IRawLayout

The IRawLayout used to render the logging event into an object for this parameter.

Remarks

The IRawLayout that renders the value for this parameter.

The RawLayoutConverter can be used to adapt any ILayout into a IRawLayout for use in the property.

ParameterName

Gets or sets the name of this parameter.

public string ParameterName { get; set; }

Property Value

string

The name of this parameter.

Remarks

The name of this parameter. The parameter name must match up to a named parameter to the SQL stored procedure or prepared statement.

Precision

Gets or sets the precision for this parameter.

public byte Precision { get; set; }

Property Value

byte

The precision for this parameter.

Remarks

The maximum number of digits used to represent the Value.

This property is optional. If not specified the ADO.NET provider will attempt to infer the precision from the value.

See Also

Scale

Gets or sets the scale for this parameter.

public byte Scale { get; set; }

Property Value

byte

The scale for this parameter.

Remarks

The number of decimal places to which Value is resolved.

This property is optional. If not specified the ADO.NET provider will attempt to infer the scale from the value.

See Also

Size

Gets or sets the size for this parameter.

public int Size { get; set; }

Property Value

int

The size for this parameter.

Remarks

The maximum size, in bytes, of the data within the column.

This property is optional. If not specified the ADO.NET provider will attempt to infer the size from the value.

For BLOB data types like VARCHAR(max) it may be impossible to infer the value automatically, use -1 as the size in this case.

See Also

Methods

FormatValue(IDbCommand, LoggingEvent)

Renders the logging event and set the parameter value in the command.

public virtual void FormatValue(IDbCommand command, LoggingEvent loggingEvent)

Parameters

command IDbCommand

The command containing the parameter.

loggingEvent LoggingEvent

The event to be rendered.

Remarks

Renders the logging event using this parameters layout object. Sets the value of the parameter on the command object.

Prepare(IDbCommand)

Prepare the specified database command object.

public virtual void Prepare(IDbCommand command)

Parameters

command IDbCommand

The command to prepare.

Remarks

Prepares the database command object by adding this parameter to its collection of parameters.