Rhino.Commons
this class is here so I can avoid having a reference to the System.Data.SqlServerCe.dll if I don't need it.
Filter out all log entries made by loggers except for the activeLogger supplied
within the scope of a statement
Be aware that after disposing of an instance of this class,
ALL registered appenders will no longer be listening to
log entries.
Writes to the database using SqlBulkCopy in async manner.
This appender ensures that even if the database is down or takes a long time to respond
the application is not being affected.
This include avoid trains in the thread pool, which would kill scalaiblity.
An example of a SQL Server table that could be logged to:
CREATE TABLE [dbo].[Log] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[Date] [datetime] NOT NULL ,
[Thread] [varchar] (255) NOT NULL ,
[Level] [varchar] (20) NOT NULL ,
[Logger] [varchar] (255) NOT NULL ,
[Message] [varchar] (4000) NOT NULL
) ON [PRIMARY]
An example configuration to log to the above table.
IMPORTANT: Column names are Case Sensitive!
Gets or sets the name of the connection string.
The name of the connection string.
Default parameters are set for:
@Date, @Thread, @Level, @Logger, @Message, @Exception
The name of the table (used when calculating row counts).
Defaults to "Logs"
The file format that will be created.
The default is for:
{0}.log4net
Where {0} is the current process name
The directory to put the logs files at.
Defaults to the current directory.
Max number of rows per file.
Defaults to 50,000
Number of backup files to use.
Defaults to 3
Marker attribute that marks a type as one that is used as a configuration
object.
Perform the conversion by mapping the configuration values
to the object properties.
Tries to resolve the component, but return null
instead of throwing if it is not there.
Useful for optional dependencies.
Tries to resolve the compoennt, but return the default
value if could not find it, instead of throwing.
Useful for optional dependencies.
The default value.
This allows you to override the global container locally
Useful for scenarios where you are replacing the global container
but needs to do some initializing that relies on it.
The code originate from this MSDN article:
http://msdn.microsoft.com/msdnmag/issues/06/03/NETMatters/
with my own additions to it later on, such as CancelAll(), WorkStarted, WorkFinished, etc.
Any modification to this variable should be done under the _callbacks lock!
Guranteed to be called before a work item starts executing
Guranteed to be called after a work item has finished executing (but not if the thread was forcefully aborted).
Gets or sets a value indicating whether this is canceled.
This is valid if and only if the work item has not started running yet.
If the WorkItem has started running, it is ignored
true if cancelledRun; otherwise, false.
Allows a master thread to wait for a set of
subservient threads to complete work.
Expose the batch functionality in ADO.Net 2.0
Microsoft in its wisdom decided to make my life hard and mark it internal.
Through the use of Reflection and some delegates magic, I opened up the functionality.
There is NO documentation for this, and likely zero support.
Use at your own risk, etc...
Observable performance benefits are 50%+ when used, so it is really worth it.
Append a command to the batch
This is required because SqlClient.SqlCommandSet will throw if
the command has no parameters.
Executes the batch
This seems to be returning the total number of affected rows in all queries
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
2
Return the batch command to be executed
The number of commands batched in this instance
Return the log entry messages created by the logger specified by
while executing the delegate
overload for
overload for
Gets or sets the name of the XML file.
The name of the XML file.
Gets or sets the XPath.
The XPath.
Gets the value read from file.
The value.
If the XPath returns multiple nodes, the values will be semicolon delimited.
Gets or sets the default namespace.
The namespace.
Gets or sets the prefix to associate with the namespace being added.
The namespace prefix.
Adapted from the MsBuild Community Tasks code, for use from code
and not from MSBuild.
Gets or sets the name of the XML file.
The name of the XML file.
Gets or sets the XPath.
The XPath.
Gets or sets the value to write.
The value.
Gets or sets the default namespace.
The namespace.
Gets or sets the prefix to associate with the namespace being added.
The namespace prefix.