Click or drag to resize
weroSoft AG, Software
TraceProvidingSource Class
The documentation is integral part of the weroSoft product documentation. This part is intended to be used by developers only.
Provides the trace sources used to write debug trace of the weroSoft trace tracking system.
Inheritance Hierarchy
SystemObject
  WeroSoft.DiagnosticsTraceProvidingSource

Namespace:  WeroSoft.Diagnostics
Assembly:  WeroSoft.Core.Library (in WeroSoft.Core.Library.dll) Version: 3.0 Pre-Release
Syntax
C#
public sealed class TraceProvidingSource : ITraceWriter
Examples
The following example shows a imperative configuration of the trace. The configuration is uses some hard coded strings which we recommend to put them into a application configuration file.
public class TraceDemo
{
    private static TraceProvidingSource trace = null;

    #region Constructor
    /// <summary>
    /// Initializes the class specific elements.
    /// </summary>
    static TraceDemo()
    {
        // Create trace source for infrastructure
        trace = TraceProvider.GetTraceSource(TraceProvidingSoftwareLayerName.Infrastructure);

        // Configure the .NET System trace settings.
        System.Diagnostics.Trace.AutoFlush = true;

        // Configure the weroSoft Core Library Trace.
        TraceProvider.Current.SwitchTraceToLevel(System.Diagnostics.SourceLevels.All);
        TraceProvider.Current.SetTraceToListener("MyListener", @"C:\Temp\MyTraceFile.trace", true);
        TraceProvider.LockSourceMode(TraceSourceProviderMode.AdvancedDateTime);
    }
    ...
    ...
    ...

The following sample shows a declarative configuration of the trace how you can make it in the application configuration file. Note that the sample shows only the configuration of the software layer 'Infrastructure'. If you like to configure more layers, you may simply add a <source> section per configuration you like to have.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.diagnostics>
    <sources>
      <source name="Infrastructure" switchType="System.Diagnostics.SourceSwitch" switchValue="All">
        <listeners>
          <add name="UnitTestTrace"/>
        </listeners>
      </source>
    </sources>
    <!-- Defines the listener used for creating the output -->
    <sharedListeners>
      <add name="UnitTestTrace" type="WeroSoft.Diagnostics.TraceStandardFileListener, WeroSoft.Core.Library" initializeData="WorkflowUnitTest.trace" autoRemove="true"/>
    </sharedListeners>
    <!-- Keep this value as defined -->
    <trace autoflush="true"/>
  </system.diagnostics>
</configuration>
For accessing the trace configured in the application configuration above you need somewhere in your code a trace object. This can be configured as shown in the code below:
public class TraceDemo
{
  public static TraceProvidingSource Trace { get; } = TraceProvider.GetTraceSource(TraceProvidingSoftwareLayerName.Infrastructure);
  ...
  ...
  ...

The TraceProvidingSource type exposes the following members.

Properties
  NameDescription
Public propertyStatic memberDiagnosticsService
Gets the diagnostics service.
Public propertyProviderMode
Gets a value indicating which type of source this source is representing.
Public propertySourceName
Gets the name of the trace source as a value.
Public propertyTraceCorrelation
Gets or sets a trace owner-action-correlation object.
Public propertyStatic memberTraceFilter
Gets or sets the trace filter on the thread.
Public propertyTraceSource
Gets the .NET trace source object for this source.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodRegisterSessionTrace
Registers the session for a session level trace.
Public methodSwitchTraceToLevel
Switch all trace sources to the defined level.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUnRegisterSessionTrace
Registers the session for a session level trace.
Public methodWriteAnalysis
Writes a trace during analysis.
Public methodWriteCritical(Exception)
Public methodWriteCritical(FuncTraceableText)
Public methodWriteCritical(TraceableText)
Public methodWriteCritical(Exception, FuncTraceableText)
Public methodWriteCritical(String, Object)
Public methodWriteCritical(TraceCorrelation, Exception)
Public methodWriteCritical(TraceCorrelation, FuncTraceableText)
Public methodWriteCritical(TraceCorrelation, TraceableText)
Public methodWriteCritical(Exception, String, Object)
Public methodWriteCritical(Exception, TraceCorrelation, FuncTraceableText)
Public methodWriteCritical(Exception, TraceCorrelation, TraceableText)
Public methodWriteCritical(TraceCorrelation, String, Object)
Public methodWriteCritical(Exception, TraceCorrelation, String, Object)
Public methodWriteDebug(FuncTraceableText)
Writes a debug trace only if tracing is configured.
Public methodWriteDebug(TraceableText)
Writes a debug trace message to the trace.
Public methodWriteDebug(String, Object)
Writes a trace message to the trace in level.
Public methodWriteDebug(TraceCorrelation, FuncTraceableText)
Writes a debug trace only if tracing is configured.
Public methodWriteDebug(TraceCorrelation, TraceableText)
Writes a debug trace message to the trace.
Public methodWriteDebug(TraceCorrelation, String, Object)
Writes a trace message to the trace in level.
Public methodWriteError(Exception)
Writes an error trace message to the trace.
Public methodWriteError(FuncTraceableText)
Writes a debug trace only if tracing is configured.
Public methodWriteError(TraceableText)
Writes an error trace message to the trace.
Public methodWriteError(Exception, FuncTraceableText)
Writes a debug trace only if tracing is configured.
Public methodWriteError(String, Object)
Writes an error trace message to the trace.
Public methodWriteError(TraceCorrelation, Exception)
Writes an error trace message to the trace.
Public methodWriteError(TraceCorrelation, FuncTraceableText)
Writes a debug trace only if tracing is configured.
Public methodWriteError(TraceCorrelation, TraceableText)
Writes an error trace message to the trace.
Public methodWriteError(Exception, String, Object)
Writes an error trace message to the trace.
Public methodWriteError(Exception, TraceCorrelation, FuncTraceableText)
Writes a debug trace only if tracing is configured.
Public methodWriteError(Exception, TraceCorrelation, TraceableText)
Writes an error trace message to the trace.
Public methodWriteError(TraceCorrelation, String, Object)
Writes an error trace message to the trace.
Public methodWriteError(Exception, TraceCorrelation, String, Object)
Writes an error trace message to the trace.
Public methodWriteInformation(FuncTraceableText)
Writes a debug trace only if tracing is configured.
Public methodWriteInformation(TraceableText)
Writes a information trace message to the trace.
Public methodWriteInformation(String, Object)
Writes a trace message to the trace in information level.
Public methodWriteInformation(TraceCorrelation, FuncTraceableText)
Writes a debug trace only if tracing is configured.
Public methodWriteInformation(TraceCorrelation, TraceableText)
Writes a information trace message to the trace.
Public methodWriteInformation(TraceCorrelation, String, Object)
Writes a trace message to the trace in information level.
Public methodWriteWarning(Exception)
Writes an error trace message to the trace.
Public methodWriteWarning(FuncTraceableText)
Writes a debug trace only if tracing is configured.
Public methodWriteWarning(TraceableText)
Writes a warning trace message to the trace.
Public methodWriteWarning(String, Object)
Writes a warning trace message to the trace.
Public methodWriteWarning(TraceCorrelation, Exception)
Writes an error trace message to the trace.
Public methodWriteWarning(TraceCorrelation, FuncTraceableText)
Writes a debug trace only if tracing is configured.
Public methodWriteWarning(TraceCorrelation, TraceableText)
Writes a warning trace message to the trace.
Public methodWriteWarning(TraceCorrelation, String, Object)
Writes a warning trace message to the trace.
Top
Fields
  NameDescription
Public fieldStatic memberTraceMarkerText
Defines the key name of a trace marker.
Top
Extension Methods
  NameDescription
Public Extension MethodClone(CloneWorkingMode, IEnumerableType)Overloaded.
Clones an object by serialization.
(Defined by RuntimeExtensions.)
Public Extension MethodCloneT(CloneWorkingMode, IEnumerableType)Overloaded.
Clones an object by serialization.
(Defined by RuntimeExtensions.)
Public Extension MethodConvert (Defined by DataConverterExtensions.)
Public Extension MethodCreateTraceDataEntry(StringBuilder, SourceLevels, TraceableKind, String)Overloaded.
Creates a data entry into a string builder according to the giving parameters.
(Defined by TraceExtensions.)
Public Extension MethodCreateTraceDataEntry(SourceLevels, TraceableKind, String, String, Int32)Overloaded.
Creates a trace entry for a data element.
(Defined by TraceExtensions.)
Public Extension MethodCreateTraceDataEntry(StringBuilder, SourceLevels, TraceableKind, String, String, Int32)Overloaded.
Creates a trace entry into a string builder.
(Defined by TraceExtensions.)
Public Extension MethodDynamicCast
Dynamically casts a reference to another type.
(Defined by TypeManagerHelper.)
Public Extension MethodExtractSystemParametersFromTrigger
Extracts the system parameters from a collection of trigger parameter and transform them to a dictionary using string keys and string values.
(Defined by TriggerExtensions.)
Public Extension MethodGetFieldValue(String)Overloaded.
Gets the data object held by a defined field of a particular type.
(Defined by UnitTest.)
Public Extension MethodGetFieldValueT(String)Overloaded.
Gets the data object held by a defined field of a particular type.
(Defined by UnitTest.)
Public Extension MethodGetPropertyValue(String)Overloaded.
Gets the data object held by a defined property of a particular type.
(Defined by UnitTest.)
Public Extension MethodGetPropertyValueT(String)Overloaded.
Gets the data object held by a defined property of a particular type.
(Defined by UnitTest.)
Public Extension MethodInject(Type, Object)Overloaded.
Injects all fields or properties which are marked with the defined attribute type name.
(Defined by DataInjection.)
Public Extension MethodInject(Type, Object, Boolean)Overloaded.
Injects all fields or properties which are marked with the defined attribute type name.
(Defined by DataInjection.)
Public Extension MethodInjectField
Injects a value to a property within a data object.
(Defined by DataInjection.)
Public Extension MethodInjectProperty(String, Object)Overloaded.
Injects a value to a property within a data object.
(Defined by DataInjection.)
Public Extension MethodInjectProperty(String, Type, Object)Overloaded.
Injects a value to a property within a data object.
(Defined by DataInjection.)
Public Extension MethodInvoke(String, Object)Overloaded.
Invokes a method on an object by reflection.
(Defined by UnitTest.)
Public Extension MethodInvokeTResult(String, Object)Overloaded.
Invokes a method on an object by reflection.
(Defined by UnitTest.)
Public Extension MethodSetFieldValue
Sets the data object on a defined field of a particular type.
(Defined by UnitTest.)
Public Extension MethodSetPropertyValue
Sets the data object on a defined property of a particular type.
(Defined by UnitTest.)
Public Extension MethodSetReadOnlyFieldValue
Sets the data object on a defined field of a particular type.
(Defined by UnitTest.)
Public Extension MethodTryInjectProperty
Tries to Inject a value to a property within a data object.
(Defined by DataInjection.)
Top
See Also