C# Класс NLog.Targets.DatabaseTarget

Наследование: Target
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
CloseConnection void
EnsureConnectionOpen void
InitializeTarget void
OpenConnection IDbConnection
RunInstallCommands void
WriteEventToDatabase void

Открытые методы

Метод Описание
DatabaseTarget ( ) : System

Initializes a new instance of the DatabaseTarget class.

DatabaseTarget ( string name ) : System

Initializes a new instance of the DatabaseTarget class.

Install ( InstallationContext installationContext ) : void

Performs installation which requires administrative permissions.

IsInstalled ( InstallationContext installationContext ) : bool?

Determines whether the item is installed.

Uninstall ( InstallationContext installationContext ) : void

Performs uninstallation which requires administrative permissions.

Защищенные методы

Метод Описание
BuildConnectionString ( LogEventInfo logEvent ) : string

Build the connectionstring from the properties.

Using ConnectionString at first, and falls back to the properties DBHost, DBUserName, DBPassword and DBDatabase

CloseTarget ( ) : void

Closes the target and releases any unmanaged resources.

Write ( AsyncLogEventInfo logEvents ) : void

Writes an array of logging events to the log target. By default it iterates on all events and passes them to "Write" method. Inheriting classes can use this method to optimize batch writes.

Write ( LogEventInfo logEvent ) : void

Writes the specified logging event to the database. It creates a new database command, prepares parameters for it by calculating layouts and executes the command.

Приватные методы

Метод Описание
CloseConnection ( ) : void
EnsureConnectionOpen ( string connectionString ) : void
InitializeTarget ( ) : void
OpenConnection ( string connectionString ) : IDbConnection
RunInstallCommands ( InstallationContext installationContext, IEnumerable commands ) : void
WriteEventToDatabase ( LogEventInfo logEvent ) : void

Описание методов

BuildConnectionString() защищенный Метод

Build the connectionstring from the properties.
Using ConnectionString at first, and falls back to the properties DBHost, DBUserName, DBPassword and DBDatabase
protected BuildConnectionString ( LogEventInfo logEvent ) : string
logEvent LogEventInfo Event to render the layout inside the properties.
Результат string

CloseTarget() защищенный Метод

Closes the target and releases any unmanaged resources.
protected CloseTarget ( ) : void
Результат void

DatabaseTarget() публичный Метод

Initializes a new instance of the DatabaseTarget class.
public DatabaseTarget ( ) : System
Результат System

DatabaseTarget() публичный Метод

Initializes a new instance of the DatabaseTarget class.
public DatabaseTarget ( string name ) : System
name string Name of the target.
Результат System

Install() публичный Метод

Performs installation which requires administrative permissions.
public Install ( InstallationContext installationContext ) : void
installationContext NLog.Config.InstallationContext The installation context.
Результат void

IsInstalled() публичный Метод

Determines whether the item is installed.
public IsInstalled ( InstallationContext installationContext ) : bool?
installationContext NLog.Config.InstallationContext The installation context.
Результат bool?

Uninstall() публичный Метод

Performs uninstallation which requires administrative permissions.
public Uninstall ( InstallationContext installationContext ) : void
installationContext NLog.Config.InstallationContext The installation context.
Результат void

Write() защищенный Метод

Writes an array of logging events to the log target. By default it iterates on all events and passes them to "Write" method. Inheriting classes can use this method to optimize batch writes.
protected Write ( AsyncLogEventInfo logEvents ) : void
logEvents AsyncLogEventInfo Logging events to be written out.
Результат void

Write() защищенный Метод

Writes the specified logging event to the database. It creates a new database command, prepares parameters for it by calculating layouts and executes the command.
protected Write ( LogEventInfo logEvent ) : void
logEvent LogEventInfo The logging event.
Результат void