[This is preliminary documentation and is subject to change.]

The DatabaseTarget type exposes the following members.

Constructors

  NameDescription
DatabaseTarget
Initializes a new instance of the DatabaseTarget class.

Methods

  NameDescription
CloseTarget
Closes the target and releases any unmanaged resources.
(Inherited from Target.)
DisposeOverloaded.
Flush
Flush any pending log messages (in case of asynchronous targets).
(Inherited from Target.)
FlushAsync
Flush any pending log messages asynchronously (in case of asynchronous targets).
(Inherited from Target.)
InitializeTarget
Initializes the target. Can be used by inheriting classes to initialize logging.
(Inherited from Target.)
Install
Performs installation which requires administrative permissions.
IsInstalled
Determines whether the item is installed.
PrecalculateVolatileLayouts
Calls the Precalculate(LogEventInfo) on each volatile layout used by this target.
(Inherited from Target.)
ToString
Returns a String that represents this instance.
(Inherited from Target.)
Uninstall
Performs uninstallation which requires administrative permissions.
WriteOverloaded.
WriteAsyncLogEvent
Writes the log to the target.
(Inherited from Target.)
WriteAsyncLogEvents
Writes the array of log events.
(Inherited from Target.)

Properties

  NameDescription
CommandText
Gets or sets the text of the SQL command to be run on each log level.
ConnectionString
Gets or sets the connection string. When provided, it overrides the values specified in DBHost, DBUserName, DBPassword, DBDatabase.
ConnectionStringName
Gets or sets the name of the connection string (as specified in <connectionStrings> configuration section.
DBDatabase
Gets or sets the database name. If the ConnectionString is not provided this value will be used to construct the "Database=" part of the connection string.
DBHost
Gets or sets the database host name. If the ConnectionString is not provided this value will be used to construct the "Server=" part of the connection string.
DBPassword
Gets or sets the database password. If the ConnectionString is not provided this value will be used to construct the "Password=" part of the connection string.
DBProvider
Gets or sets the name of the database provider.
DBUserName
Gets or sets the database user name. If the ConnectionString is not provided this value will be used to construct the "User ID=" part of the connection string.
InstallConnectionString
Gets or sets the connection string using for installation and uninstallation. If not provided, regular ConnectionString is being used.
InstallDdlCommands
Gets the installation DDL commands.
IsInitialized
Gets a value indicating whether the target has been initialized.
(Inherited from Target.)
KeepConnection
Gets or sets a value indicating whether to keep the database connection open between the log events.
LoggingConfiguration
Gets the logging configuration this target is part of.
(Inherited from Target.)
Name
Gets or sets the name of the target.
(Inherited from Target.)
Parameters
Gets the collection of parameters. Each parameter contains a mapping between NLog layout and a database named or positional parameter.
SyncRoot
Gets the object which can be used to synchronize asynchronous operations that must rely on the .
(Inherited from Target.)
UninstallDdlCommands
Gets the uninstallation DDL commands.
UseTransactions
Gets or sets a value indicating whether to use database transactions. Some data providers require this.

See Also