C# Class StackExchange.Exceptional.MySQL.MySQLErrorStore

An ErrorStore implementation that uses MySQL as its backing store.
Inheritance: ErrorStore
Show file Open project: NickCraver/StackExchange.Exceptional

Public Methods

Method Description
MySQLErrorStore ( ErrorStoreSettings settings ) : System

Creates a new instance of SQLErrorStore with the given configuration.

MySQLErrorStore ( string connectionString, int displayCount = DefaultDisplayCount, int rollupSeconds = DefaultRollupSeconds ) : System

Creates a new instance of SQLErrorStore with the specified connection string.

Protected Methods

Method Description
DeleteAllErrors ( string applicationName = null ) : bool

Deleted all errors in the log, by setting DeletionDate = UTC_DATE() in SQL

DeleteError ( System.Guid guid ) : bool

Deletes an error, by setting DeletionDate = UTC_DATE() in SQL

DeleteErrors ( IEnumerable guids ) : bool

Deletes errors, by setting DeletionDate = UTC_DATE() in SQL

GetAllErrors ( List errors, string applicationName = null ) : int

Retrieves all non-deleted application errors in the database

GetError ( System.Guid guid ) : Error

Gets the error with the specified guid from SQL This can return a deleted error as well, there's no filter based on DeletionDate

GetErrorCount ( System.DateTime since = null, string applicationName = null ) : int

Retrieves a count of application errors since the specified date, or all time if null

HardDeleteError ( System.Guid guid ) : bool

Hard deletes an error, actually deletes the row from SQL rather than setting DeletionDate This is used to cleanup when testing the error store when attempting to come out of retry/failover mode after losing connection to SQL

LogError ( Error error ) : void

Logs the error to SQL If the rollup conditions are met, then the matching error will have a DuplicateCount += @DuplicateCount (usually 1, unless in retry) rather than a distinct new row for the error

ProtectError ( Guid guid ) : bool

Protects an error from deletion, by making IsProtected = 1 in the database

ProtectErrors ( IEnumerable guids ) : bool

Protects errors from deletion, by making IsProtected = 1 in the database

Private Methods

Method Description
GetConnection ( ) : MySqlConnection

Method Details

DeleteAllErrors() protected method

Deleted all errors in the log, by setting DeletionDate = UTC_DATE() in SQL
protected DeleteAllErrors ( string applicationName = null ) : bool
applicationName string
return bool

DeleteError() protected method

Deletes an error, by setting DeletionDate = UTC_DATE() in SQL
protected DeleteError ( System.Guid guid ) : bool
guid System.Guid The guid of the error to delete
return bool

DeleteErrors() protected method

Deletes errors, by setting DeletionDate = UTC_DATE() in SQL
protected DeleteErrors ( IEnumerable guids ) : bool
guids IEnumerable The guids of the error to delete
return bool

GetAllErrors() protected method

Retrieves all non-deleted application errors in the database
protected GetAllErrors ( List errors, string applicationName = null ) : int
errors List
applicationName string
return int

GetError() protected method

Gets the error with the specified guid from SQL This can return a deleted error as well, there's no filter based on DeletionDate
protected GetError ( System.Guid guid ) : Error
guid System.Guid The guid of the error to retrieve
return Error

GetErrorCount() protected method

Retrieves a count of application errors since the specified date, or all time if null
protected GetErrorCount ( System.DateTime since = null, string applicationName = null ) : int
since System.DateTime
applicationName string
return int

HardDeleteError() protected method

Hard deletes an error, actually deletes the row from SQL rather than setting DeletionDate This is used to cleanup when testing the error store when attempting to come out of retry/failover mode after losing connection to SQL
protected HardDeleteError ( System.Guid guid ) : bool
guid System.Guid The guid of the error to hard delete
return bool

LogError() protected method

Logs the error to SQL If the rollup conditions are met, then the matching error will have a DuplicateCount += @DuplicateCount (usually 1, unless in retry) rather than a distinct new row for the error
protected LogError ( Error error ) : void
error Error The error to log
return void

MySQLErrorStore() public method

Creates a new instance of SQLErrorStore with the given configuration.
public MySQLErrorStore ( ErrorStoreSettings settings ) : System
settings ErrorStoreSettings
return System

MySQLErrorStore() public method

Creates a new instance of SQLErrorStore with the specified connection string.
public MySQLErrorStore ( string connectionString, int displayCount = DefaultDisplayCount, int rollupSeconds = DefaultRollupSeconds ) : System
connectionString string The database connection string to use
displayCount int /// How many errors to display in the log (for display ONLY, the log is not truncated to this /// value) ///
rollupSeconds int /// The rollup seconds, defaults to , duplicate /// errors within this time period will be rolled up ///
return System

ProtectError() protected method

Protects an error from deletion, by making IsProtected = 1 in the database
protected ProtectError ( Guid guid ) : bool
guid Guid The guid of the error to protect
return bool

ProtectErrors() protected method

Protects errors from deletion, by making IsProtected = 1 in the database
protected ProtectErrors ( IEnumerable guids ) : bool
guids IEnumerable The guids of the error to protect
return bool