diff --git a/Commons.sln b/Commons.sln index a4f9c80..9fdd33b 100644 --- a/Commons.sln +++ b/Commons.sln @@ -23,6 +23,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Version.props = Version.props EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "net.adamec.lib.common.core", "net.adamec.lib.common.core\net.adamec.lib.common.core.csproj", "{816D49A1-45D3-41BA-9F6D-7239D467E253}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -41,6 +43,10 @@ Global {D09F8AE6-47AA-40B7-BFE7-E362B1C970C7}.Debug|Any CPU.Build.0 = Debug|Any CPU {D09F8AE6-47AA-40B7-BFE7-E362B1C970C7}.Release|Any CPU.ActiveCfg = Release|Any CPU {D09F8AE6-47AA-40B7-BFE7-E362B1C970C7}.Release|Any CPU.Build.0 = Release|Any CPU + {816D49A1-45D3-41BA-9F6D-7239D467E253}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {816D49A1-45D3-41BA-9F6D-7239D467E253}.Debug|Any CPU.Build.0 = Debug|Any CPU + {816D49A1-45D3-41BA-9F6D-7239D467E253}.Release|Any CPU.ActiveCfg = Release|Any CPU + {816D49A1-45D3-41BA-9F6D-7239D467E253}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Version.props b/Version.props index 2da3e0f..70b6248 100644 --- a/Version.props +++ b/Version.props @@ -7,13 +7,13 @@ ======================================================================================= --> - 1 - 2 - 0 - 538 - 1.2.0 - 1.2.0+538.190122135212.master.2404837 - 2404837 - master + 2 + 0 + 1 + 552 + 2.0.1 + 2.0.1+552.190707161143.release.eea80db + eea80db + release \ No newline at end of file diff --git a/build.tasks/build.tasks.csproj b/build.tasks/build.tasks.csproj index e6b63fc..a98d65a 100644 --- a/build.tasks/build.tasks.csproj +++ b/build.tasks/build.tasks.csproj @@ -2,6 +2,7 @@ netstandard2.0 + 7.1 diff --git a/build/build.csproj b/build/build.csproj index 7a82530..c71eff6 100644 --- a/build/build.csproj +++ b/build/build.csproj @@ -4,6 +4,7 @@ netstandard2.0 false + 7.1 diff --git a/changelog.md b/changelog.md index 6b255a5..fa6919c 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## Unreleased ## + +## [2.0.1] - 2019-07-07 ## +### Breaking Changes ### +Created nuget package `RadCommons.core` containing `BaseDisposable` class, `Configuration` class and logging that are no longer available as source-only packages mainly due to a `public` members and/or limitations of having them as `internal` (problems with inheritance in consuming code). This nuget package is needed by some of the source-only packages. + +### Fixed ### +CommonLogging: Fix in DebugCorr (removed dummy log item) +BaseDisposable: DisposedManaged and DisposedNative thread safety +Configuration: removed reference to CommonLogging (was not used at all) +RadCommons.di.Component: removed reference to CommonLogging (was not used at all), removed reference to itself (fix) + +### Changes ### +AsyncManager: removed reference to (and used of) CommonLogging +RadCommons.di.Config: removed reference to (and used of) CommonLogging +RadCommons.di.PostInit: removed reference to (and used of) CommonLogging + ## [1.2.0] - 2019-01-22 ## ### Added ### - Added `Disposer` - Keeps the stack of disposable objects, and disposes them when the disposer is being disposed. @@ -56,6 +73,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Initial release - NuGet packages are not published yet, they will be published with v1.0.0 +[2.0.1]: https://github.com/adamecr/Commons/compare/v1.2.0...v2.0.1 [1.2.0]: https://github.com/adamecr/Commons/compare/v1.1.0...v1.2.0 [1.1.0]: https://github.com/adamecr/Commons/compare/v1.0.0...v1.1.0 [1.0.0]: https://github.com/adamecr/Commons/compare/v0.1.0...v1.0.0 diff --git a/doc/net.adamec.lib.common.core.html b/doc/net.adamec.lib.common.core.html new file mode 100644 index 0000000..c348b5f --- /dev/null +++ b/doc/net.adamec.lib.common.core.html @@ -0,0 +1,1500 @@ + + + +Documentation + + + + + + + +

Documentation

+

Namespaces

+ + + + +
NameSummary
net.adamec.lib.common.core.config
net.adamec.lib.common.core.logging
net.adamec.lib.common.core.utils
+

Types

+ + + + + + + +
NameModifierKindSummary
BaseDisposablepublic abstractClassHelper class for implementation of System.IDisposable types
CommonLoggingpublic staticClassILogger factory
ConfigurationpublicClassSingleton holding the application configuration (options)
Configuration.ConfigurationBuilderpublicClassConfiguration builder providing the methods for adding the configuration items from individual sources
LoggerExtpublicClassExtended logger implementing ILogger
ILoggerpublic abstractInterfaceLogger interface - wrapper around the NLog.ILogger with some additional methods
+

Go to namespaces or types

+

+

net.adamec.lib.common.core.config Namespace

+

Classes

+ + + +
NameModifierSummary
ConfigurationpublicSingleton holding the application configuration (options)
Configuration.ConfigurationBuilderpublicConfiguration builder providing the methods for adding the configuration items from individual sources
+

+

Go to namespaces or types

+

+

Configuration Class

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Sources: config\Configuration.cs

+

Singleton holding the application configuration (options)

+
public sealed class Configuration
+

Inheritance: object
+

+

Remarks

+

This is the simple configuration container in case DI with more sophisticated containers is not used The configuration is stored as the key-value dictionary, supporting hierarchy using the dot separator and arrays.The arrays can contain values or another objects. Actually, mixed arrays of values and objects can be stored, but they are not supported for binding.

For example section1.option1 means the option1 available in section1, section1.subSection2.option1 means the option1 available in section1.subSection2. section1.option1[0] means, that the option1 is array of values or objects (sections) within the section1. For arrays, the keys are like OtherSection.SimpleArray[0] or OtherSection.ComplexObjectArray[0].Name

Configuration class provides a singleton instance, however the key functionality is provided via static functions, so no need to touch the Instance at all. The items can be retrieved by key using the Get(string) and Get<TValueType>(string, Configuration.TValueType) methods. The first one returns null when the key is not found, the other one allow to define the default value to be returned, when the item is not found.

The inner class Configuration.ConfigurationBuilder provides the methods to build the configuration from JSON config files, commandline arguments, environment values and/or direct entries. The static method Builder() clears the configuration items and binding cache and creates a new instance of Configuration.ConfigurationBuilder allowing to build a configuration from scratch. The configuration is updated directly during the calls to builder methods, the existing items (keys) are updated, so it's possible to manage the priority of individual sources and the overrides if needed. The method Build() returns the configuration instance, breaking the fluent design of builder methods, however there is no other functionality within the method, so it's more the convention than need to use it at the end of configuration build.

Configuration binding it the way, how to access the configuration using the configuration objects instead of querying the individual items by key. When the method Bind<TOptionsContainer>(string, bool) is used, it creates a new instance of given type and tries to map the public properties with public setter to the keys (using the "dot notation") within the Configuration . It's possible to bind the object to to the root of the configuration to provide the whole configuration at once or bind it to the particular section to provide a configuration sub-tree. In general, the nested objects and both value and object arrays are supported. There are some rules when binding the arrays: The index must start with zero and must be in sequence (the first non-existing index stops the evaluation). The array should not mix the array or values and array of objects. The decision is made at the first item (index=0) whether it's value or object.

The implementation of binding treats the System.Boolean values the special way - if there is no value, but existing key, the value is converted to true. This is useful when the command line arguments are used like flags. For example having the argument -p:SkipStep1 and prefix -p: , the binding a bool property SkipStep1 will set the value of the property to true (doesn't change the configuration item itself). Of course, it's still possible to use the syntax -p:SkipStep1=true or -p:SkipStep1=false even in this case.

As the binding uses the reflection, it's quite expensive operation, so by default, the bound objects are cached (the cache key is the type of bound object, so binding the same type to different sections is not recommended ). It's possible to force the binding using the parameter of Bind<TOptionsContainer>(string, bool) method. In general, the recommended pattern is to Bind<TOptionsContainer>(string, bool) the configuration object after the configuration is built and then Retrieve<TOptionsContainer>() it from the cache when needed.

+

Fields

+ + + +
NameModifierSummary
bindingsCacheprivateCache for bindings. Dictionary of type bound as a key and the bound object as value.
instanceprivate staticInstance of the Configuration created when the singleton is first touched
+

+

Properties

+ + + +
NameModifierSummary
Instancepublic staticPublic Configuration instance
ItemsprivateConfiguration items stored as key-value pairs
+

+

Constructors

+ + + +
NameModifierSummary
Configuration()private staticStatic constructor
Configuration()privatePrivate constructor used to build the singleton instance
+

+

Methods

+ + + + + + + + + + +
NameModifierSummary
AddOrUpdateItem(string, object)privateAdd a new configuration item with given value or updates its value if the key already exists.
Bind(Type, string)private staticCreates a new object with given type and binds the configuration to its public properties where possible.
Bind<TOptionsContainer>(string, bool)public staticBinds the configuration to given TOptionsContainer type and returns the bound object of such type. The resulting configuration object is stored to the cache and can be later on retrieved using Retrieve<TOptionsContainer>()
Builder()public staticClears the configuration items and binding cache and creates a new instance of Configuration.ConfigurationBuilder
Get(string)public staticGets the configuration item by key
Get<TValueType>(string, Configuration.TValueType)public staticGets the typed configuration item by key . Returns the default value, that can be provided or is default to given TValueType The function tries to convert the value to TValueType using System.Convert.ChangeType(System.Object,System.Type) if the conversion is not successful, the default is returned.
GetSection(string)private staticGets the configuration sub-tree that belongs to given section. The keys returned are relative to given section! When the section is not provided, the whole configuration tree is returned.
Retrieve<TOptionsContainer>()public staticRetrieves the configuration object of given TOptionsContainer that has been bound and cached before. The new instance of TOptionsContainer is created when the type not found in cache
TryConvertValue(Type, object, object)private staticTries to convert sourceValue to targetType . The converted values is returned in targetValue out parameter, the result of conversion is the function return value.
+

+

Go to namespaces or types

+

+

Configuration.bindingsCache Field

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration
+Sources: config\Configuration.cs

+

Cache for bindings. Dictionary of type bound as a key and the bound object as value.

+
private readonly ConcurrentDictionary<System.Type,object> bindingsCache
+

Field value

System.Collections.Concurrent.ConcurrentDictionary<System.Type,object>

+

Remarks

+

Cache is used to prevent the "expensive" binding operation in case there is no need to refresh the bound configuration object

+

Go to namespaces or types

+

+

Configuration.instance Field

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration
+Sources: config\Configuration.cs

+

Instance of the Configuration created when the singleton is first touched

+
private static readonly Configuration instance
+

Field value

net.adamec.lib.common.core.config.Configuration

+

Remarks

+

Not using the auto-property to have better control, when the instance is created

+

Go to namespaces or types

+

+

Configuration.Instance Property

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration
+Sources: config\Configuration.cs

+

Public Configuration instance

+
public static Configuration Instance { get; }
+

Property value

net.adamec.lib.common.core.config.Configuration

+

Go to namespaces or types

+

+

Configuration.Items Property

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration
+Sources: config\Configuration.cs

+

Configuration items stored as key-value pairs

+
private ConcurrentDictionary<string,object> Items { get; }
+

Property value

System.Collections.Concurrent.ConcurrentDictionary<string,object>

+

Go to namespaces or types

+

+

Configuration.Configuration() Constructor

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration
+Sources: config\Configuration.cs

+

Static constructor

+
private static Configuration()
+

Remarks

+

Explicit static constructor to tell C# compiler not to mark type as beforefieldinit

+

Go to namespaces or types

+

+

Configuration.Configuration() Constructor

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration
+Sources: config\Configuration.cs

+

Private constructor used to build the singleton instance

+
private Configuration()
+

Go to namespaces or types

+

+

Configuration.AddOrUpdateItem(string, object) Method

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration
+Sources: config\Configuration.cs

+

Add a new configuration item with given value or updates its value if the key already exists.

+
private void AddOrUpdateItem(string key, object value)
+Method parameters
string key
Configuration item key
object value
The value to be set for the configuration item
+

Return value

void

+

Exceptions

+

System.ArgumentException
key is null or empty

+

Go to namespaces or types

+

+

Configuration.Bind(Type, string) Method

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration
+Sources: config\Configuration.cs

+

Creates a new object with given type and binds the configuration to its public properties where possible.

+
private static object Bind(Type type, string sectionName = null)
+Method parameters
System.Type type
Type to bind the configuration to
string sectionName
Optional section to bind
+

Return value

object
The instance of type bound to the configuration

+

Remarks

+

This method doesn't use the binding cache

+

Exceptions

+

System.ArgumentNullException
type is null

+

Go to namespaces or types

+

+

Configuration.Bind<TOptionsContainer>(string, bool) Method

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration
+Sources: config\Configuration.cs

+

Binds the configuration to given TOptionsContainer type and returns the bound object of such type. The resulting configuration object is stored to the cache and can be later on retrieved using Retrieve<TOptionsContainer>()

+
public static Configuration.TOptionsContainer Bind<TOptionsContainer>(string sectionName = null, bool allowCached = true) where TOptionsContainer: new()
+Type parameters
TOptionsContainer
Type to bind the configuration to
+Method parameters
string sectionName
Optional section to bind
bool allowCached
True if the cache of bindings can be used to retrieve existing binding with the same TOptionsContainer and sectionName
+

Return value

net.adamec.lib.common.core.config.Configuration.TOptionsContainer
The instance of TOptionsContainer bound to the configuration

+

Go to namespaces or types

+

+

Configuration.Builder() Method

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration
+Sources: config\Configuration.cs

+

Clears the configuration items and binding cache and creates a new instance of Configuration.ConfigurationBuilder

+
public static Configuration.ConfigurationBuilder Builder()
+

Return value

net.adamec.lib.common.core.config.Configuration.ConfigurationBuilder
The instance of Configuration.ConfigurationBuilder

+

Go to namespaces or types

+

+

Configuration.Get(string) Method

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration
+Sources: config\Configuration.cs

+

Gets the configuration item by key

+
public static object Get(string key)
+Method parameters
string key
Key of the configuration item
+

Return value

object
Retrieved configuration item value or null if not found (or the configuration item is null itself)

+

Go to namespaces or types

+

+

Configuration.Get<TValueType>(string, Configuration.TValueType) Method

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration
+Sources: config\Configuration.cs

+

Gets the typed configuration item by key . Returns the default value, that can be provided or is default to given TValueType The function tries to convert the value to TValueType using System.Convert.ChangeType(System.Object,System.Type) if the conversion is not successful, the default is returned.

+
public static Configuration.TValueType Get<TValueType>(string key, Configuration.TValueType defaultValue = null)
+Type parameters
TValueType
The type the value is to be retrieved in
+Method parameters
string key
Key of the configuration item
net.adamec.lib.common.core.config.Configuration.TValueType defaultValue
Optional default value to be returned when the value can't be retrieved of converted
+

Return value

net.adamec.lib.common.core.config.Configuration.TValueType
Retrieved configuration item value or defaultValue when it can't be retrieved or converted

+

Go to namespaces or types

+

+

Configuration.GetSection(string) Method

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration
+Sources: config\Configuration.cs

+

Gets the configuration sub-tree that belongs to given section. The keys returned are relative to given section! When the section is not provided, the whole configuration tree is returned.

+
private static Dictionary<string,object> GetSection(string sectionName = null)
+Method parameters
string sectionName
Optional name of the section.
+

Return value

Dictionary<string,object>
The configuration items that belong to the section with sectionName . The keys in returned dictionary are relative to given section!

+

Go to namespaces or types

+

+

Configuration.Retrieve<TOptionsContainer>() Method

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration
+Sources: config\Configuration.cs

+

Retrieves the configuration object of given TOptionsContainer that has been bound and cached before. The new instance of TOptionsContainer is created when the type not found in cache

+
public static Configuration.TOptionsContainer Retrieve<TOptionsContainer>() where TOptionsContainer: new()
+Type parameters
TOptionsContainer
Type of the configuration class to retrieve from cache
+

Return value

net.adamec.lib.common.core.config.Configuration.TOptionsContainer
The instance of TOptionsContainer bound to the configuration or a new instance if not found

+

Go to namespaces or types

+

+

Configuration.TryConvertValue(Type, object, object) Method

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration
+Sources: config\Configuration.cs

+

Tries to convert sourceValue to targetType . The converted values is returned in targetValue out parameter, the result of conversion is the function return value.

+
private static bool TryConvertValue(Type targetType, object sourceValue, out object targetValue)
+Method parameters
System.Type targetType
Target (property) type
object sourceValue
Source value as stored in configuration item
object targetValue
sourceValue converted to targetType when the conversion succeeded (return value is true) or source value otherwise
+

Return value

bool
The result or conversion. If true, the targetValue can be set to property having targetType

+

Remarks

+

The implementation treats the System.Boolean values the special way - if there is no value, but existing key, the value is converted to true.

+

Go to namespaces or types

+

+

Configuration.ConfigurationBuilder Class

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Sources: config\Configuration.cs

+

Configuration builder providing the methods for adding the configuration items from individual sources

+
public class Configuration.ConfigurationBuilder
+

Inheritance: object
+

+

Methods

+ + + + + + +
NameModifierSummary
Add(string, object)publicAdd a new configuration item with given value or updates its value if the key already exists.
AddCommandLineArguments(string[])publicAdds the command line arguments starting with prefixes into the Configuration . When a configuration item exists, the value is updated.
AddEnvironmentVariables()publicAdds all environment variables into the Configuration . When a configuration item exists, the value is updated.
AddJsonFile(string, bool, bool)publicLoads the configuration items from JSON file, keeping the hierarchy of JSON objects (and arrays) When a configuration item exists, the value is updated.
Build()publicFinishes the configuration building and returns the Instance
+

+

Go to namespaces or types

+

+

Configuration.ConfigurationBuilder.Add(string, object) Method

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration.ConfigurationBuilder
+Sources: config\Configuration.cs

+

Add a new configuration item with given value or updates its value if the key already exists.

+
public Configuration.ConfigurationBuilder Add(string key, object value)
+Method parameters
string key
Configuration item key
object value
The value to be set for the configuration item
+

Return value

net.adamec.lib.common.core.config.Configuration.ConfigurationBuilder
The current Configuration.ConfigurationBuilder

+

Exceptions

+

System.ArgumentException
key is null or empty

+

Go to namespaces or types

+

+

Configuration.ConfigurationBuilder.AddCommandLineArguments(string[]) Method

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration.ConfigurationBuilder
+Sources: config\Configuration.cs

+

Adds the command line arguments starting with prefixes into the Configuration . When a configuration item exists, the value is updated.

+
public Configuration.ConfigurationBuilder AddCommandLineArguments(params string[] prefixes)
+Method parameters
string[] prefixes
Optional list of prefixes marking the command line arguments to be the configuration items
+

Return value

net.adamec.lib.common.core.config.Configuration.ConfigurationBuilder
The current Configuration.ConfigurationBuilder

+

Remarks

+

The command line arguments have the syntax key=value (for example Key1=Option1 or prefixkey=value (for example -p:Key1=Option1 where -p: is the prefix). When the prefixes are not provided, all command line arguments are added to the configuration. When the prefixes are provided,the prefix is not a part of the key.

The implementation of binding treats the System.Boolean values the special way - if there is no value, but existing key, the value is converted to true, allowing to use the parameters like flags. For example having the argument -p:SkipStep1 and prefix -p: , the binding a bool property SkipStep1 will set the value of the property to true (doesn't change the configuration item itself). Of course, it's still possible to use the syntax -p:SkipStep1=true or -p:SkipStep1=false even in this case.

+

Go to namespaces or types

+

+

Configuration.ConfigurationBuilder.AddEnvironmentVariables() Method

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration.ConfigurationBuilder
+Sources: config\Configuration.cs

+

Adds all environment variables into the Configuration . When a configuration item exists, the value is updated.

+
public Configuration.ConfigurationBuilder AddEnvironmentVariables()
+

Return value

net.adamec.lib.common.core.config.Configuration.ConfigurationBuilder
The current Configuration.ConfigurationBuilder

+

Remarks

+

The name of the environment variable is used as a key to the configuration item. Use the "dot notation" in variable names to support the configuration hierarchy.

+

Go to namespaces or types

+

+

Configuration.ConfigurationBuilder.AddJsonFile(string, bool, bool) Method

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration.ConfigurationBuilder
+Sources: config\Configuration.cs

+

Loads the configuration items from JSON file, keeping the hierarchy of JSON objects (and arrays) When a configuration item exists, the value is updated.

+
public Configuration.ConfigurationBuilder AddJsonFile(string fileName, bool ignoreNullOrEmptyFileName = false, bool ignoreIfNotExist = false)
+Method parameters
string fileName
Name of the JSON file with configuration
bool ignoreNullOrEmptyFileName
If true, the missing file name will not throw the exception and the method just "silently" ends.
bool ignoreIfNotExist
If true, the non existing file will not throw the exception and the method just "silently" ends.
+

Return value

net.adamec.lib.common.core.config.Configuration.ConfigurationBuilder
The current Configuration.ConfigurationBuilder

+

Exceptions

+

System.ArgumentException
fileName is null or empty and ignoreNullOrEmptyFileName is false
System.ArgumentException
fileName doesn't exist and ignoreIfNotExist is false

+

Go to namespaces or types

+

+

Configuration.ConfigurationBuilder.Build() Method

+

Namespace: net.adamec.lib.common.core.config
+Assembly: net.adamec.lib.common.core
+Type: Configuration.ConfigurationBuilder
+Sources: config\Configuration.cs

+

Finishes the configuration building and returns the Instance

+
public Configuration Build()
+

Return value

net.adamec.lib.common.core.config.Configuration
The Configuration singleton

+

Go to namespaces or types

+

+

net.adamec.lib.common.core.logging Namespace

+

Classes

+ + + +
NameModifierSummary
CommonLoggingpublic staticILogger factory
LoggerExtpublicExtended logger implementing ILogger
+

+

Interfaces

+ + +
NameModifierSummary
ILoggerpublic abstractLogger interface - wrapper around the NLog.ILogger with some additional methods
+

+

Go to namespaces or types

+

+

CommonLogging Class

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Sources: logging\CommonLogging.cs

+

ILogger factory

+
public static class CommonLogging
+

Inheritance: object
+

+

Methods

+ + + + +
NameModifierSummary
CreateLogger(string)public staticCreates the logger with given categoryName
CreateLogger(Type)public staticCreates the logger for given type. The name of the logger will be System.Type.FullName
CreateLogger<T>()public staticCreates the logger for given type. The name of the logger will be System.Type.FullName
+

+

Go to namespaces or types

+

+

CommonLogging.CreateLogger(string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: CommonLogging
+Sources: logging\CommonLogging.cs

+

Creates the logger with given categoryName

+
public static ILogger CreateLogger(string categoryName)
+Method parameters
string categoryName
Name of the logger
+

Return value

net.adamec.lib.common.core.logging.ILogger
Logger instance

+

Go to namespaces or types

+

+

CommonLogging.CreateLogger(Type) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: CommonLogging
+Sources: logging\CommonLogging.cs

+

Creates the logger for given type. The name of the logger will be System.Type.FullName

+
public static ILogger CreateLogger(Type type)
+Method parameters
System.Type type
Type to create the logger for
+

Return value

net.adamec.lib.common.core.logging.ILogger
Logger instance

+

Go to namespaces or types

+

+

CommonLogging.CreateLogger<T>() Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: CommonLogging
+Sources: logging\CommonLogging.cs

+

Creates the logger for given type. The name of the logger will be System.Type.FullName

+
public static ILogger CreateLogger<T>()
+Type parameters
T
Type to create the logger for
+

Return value

net.adamec.lib.common.core.logging.ILogger
Logger instance

+

Go to namespaces or types

+

+

LoggerExt Class

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Sources: logging\LoggerExt.CorrelationId.cs, logging\LoggerExt.cs, logging\LoggerExt.EventProperties.cs, logging\LoggerExt.ExceptionFilter.cs, logging\LoggerExt.ExceptionPassThrough.cs

+

Extended logger implementing ILogger

+
public class LoggerExt : Logger, ILogger
+

Inheritance: object -> NLog.Logger
+Implements: net.adamec.lib.common.core.logging.ILogger, NLog.ILogger, NLog.ILoggerBase, NLog.ISuppress

+

Methods

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameModifierSummary
CreateException<TException>(string, string, Exception)private staticWrites the diagnostic message at the Fatal level. Creates and returns the exception of given type
Debug(Dictionary<string,object>, string)publicWrites the diagnostic message at the Debug level.
DebugCorr(string, string)publicWrites the diagnostic message at the Debug level with correlation ID.
Error(Dictionary<string,object>, Exception, string)publicWrites the diagnostic message at the Error level.
Error(Dictionary<string,object>, string)publicWrites the diagnostic message at the Error level.
Error<TException>(string, Exception)publicWrites the diagnostic message at the Error level. Creates and returns the exception of given type
ErrorCorr(string, Exception, string)publicWrites the diagnostic message at the Error level with correlation ID.
ErrorCorr(string, string)publicWrites the diagnostic message at the Error level with correlation ID.
ErrorCorr<TException>(string, LoggerExt.TException, string)publicWrites the diagnostic message at the Error level and returns the exception of given type
ErrorCorr<TException>(string, string, Exception)publicWrites the diagnostic message at the Error level with correlation ID. Creates and returns the exception of given type
ErrorFltr<TException>(LoggerExt.TException, string, bool)publicWrites the diagnostic message at the Error level and returns the exception of given type
ErrorFltrCorr<TException>(string, LoggerExt.TException, string, bool)publicWrites the diagnostic message at the Error level and returns the exception of given type
ErrorPassThrough(Exception, string)publicWrites the diagnostic message at the Error level and returns given exception
Fatal(Dictionary<string,object>, Exception, string)publicWrites the diagnostic message at the Fatal level.
Fatal(Dictionary<string,object>, string)publicWrites the diagnostic message at the Fatal level.
Fatal<TException>(string, Exception)publicWrites the diagnostic message at the Fatal level. Creates and returns the exception of given type
FatalCorr(string, Exception, string)publicWrites the diagnostic message at the Fatal level with correlation ID.
FatalCorr(string, string)publicWrites the diagnostic message at the Fatal level with correlation ID.
FatalCorr<TException>(string, LoggerExt.TException, string)publicWrites the diagnostic message at the Fatal level and returns the exception of given type
FatalCorr<TException>(string, string, Exception)publicWrites the diagnostic message at the Fatal level with correlation ID. Creates and returns the exception of given type
FatalFltr<TException>(LoggerExt.TException, string, bool)publicWrites the diagnostic message at the Fatal level and returns catchIt value.
FatalFltrCorr<TException>(string, LoggerExt.TException, string, bool)publicWrites the diagnostic message at the Fatal level and returns catchIt value.
FatalPassThrough(Exception, string)publicWrites the diagnostic message at the Fatal level and returns given exception >
Info(Dictionary<string,object>, string)publicWrites the diagnostic message at the Info level.
InfoCorr(string, string)publicWrites the diagnostic message at the Info level with correlation ID.
LogIt(LogLevel, Dictionary<string,object>, string, Exception, string)privateWrites the item (message with optional event properties and exception) into the log
LogIt(LogLevel, string, Exception, string)privateWrites the item (message with optional exception) into the log
LogIt(LogLevel, string, string, Exception, string)privateWrites the item (message with optional exception) with correlation Id into the log
Trace(Dictionary<string,object>, string)publicWrites the diagnostic message at the Trace level.
TraceCorr(string, string)publicWrites the diagnostic message at the Trace level with correlation ID
Warn(Dictionary<string,object>, Exception, string)publicWrites the diagnostic message at the Warn level.
Warn(Dictionary<string,object>, string)publicWrites the diagnostic message at the Warn level.
WarnCorr(string, Exception, string)publicWrites the diagnostic message at the Warn level with correlation ID.
WarnCorr(string, string)publicWrites the diagnostic message at the Warn level with correlation ID.
+

+

Go to namespaces or types

+

+

LoggerExt.CreateException<TException>(string, string, Exception) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.cs

+

Writes the diagnostic message at the Fatal level. Creates and returns the exception of given type

+
private static LoggerExt.TException CreateException<TException>(string message, out string stackTrace, Exception innerException = null) where TException: Exception
+Type parameters
TException
+Method parameters
string message
Log message.
string stackTrace
Stack trace to be logged in StackTrace event property
System.Exception innerException
Exception to be logged
+

Return value

net.adamec.lib.common.core.logging.LoggerExt.TException
Created exception

+

Go to namespaces or types

+

+

LoggerExt.Debug(Dictionary<string,object>, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.EventProperties.cs

+

Writes the diagnostic message at the Debug level.

+
public void Debug(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+

Return value

void
Implements: ILogger.Debug(Dictionary<string,object>, string)

+

Go to namespaces or types

+

+

LoggerExt.DebugCorr(string, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the diagnostic message at the Debug level with correlation ID.

+
public void DebugCorr(string correlationId, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
string message
Log message.
+

Return value

void
Implements: ILogger.DebugCorr(string, string)

+

Go to namespaces or types

+

+

LoggerExt.Error(Dictionary<string,object>, Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.EventProperties.cs

+

Writes the diagnostic message at the Error level.

+
public void Error(Dictionary<string,object> eventProperties, Exception exception, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

void
Implements: ILogger.Error(Dictionary<string,object>, Exception, string)

+

Go to namespaces or types

+

+

LoggerExt.Error(Dictionary<string,object>, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.EventProperties.cs

+

Writes the diagnostic message at the Error level.

+
public void Error(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+

Return value

void
Implements: ILogger.Error(Dictionary<string,object>, string)

+

Go to namespaces or types

+

+

LoggerExt.Error<TException>(string, Exception) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.ExceptionPassThrough.cs

+

Writes the diagnostic message at the Error level. Creates and returns the exception of given type

+
public LoggerExt.TException Error<TException>(string message, Exception innerException = null) where TException: Exception
+Type parameters
TException
+Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
+

Return value

net.adamec.lib.common.core.logging.LoggerExt.TException
Created exception
Implements: ILogger.Error<TException>(string, Exception)

+

Go to namespaces or types

+

+

LoggerExt.ErrorCorr(string, Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the diagnostic message at the Error level with correlation ID.

+
public void ErrorCorr(string correlationId, Exception exception, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

void
Implements: ILogger.ErrorCorr(string, Exception, string)

+

Go to namespaces or types

+

+

LoggerExt.ErrorCorr(string, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the diagnostic message at the Error level with correlation ID.

+
public void ErrorCorr(string correlationId, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
string message
Log message.
+

Return value

void
Implements: ILogger.ErrorCorr(string, string)

+

Go to namespaces or types

+

+

LoggerExt.ErrorCorr<TException>(string, LoggerExt.TException, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the diagnostic message at the Error level and returns the exception of given type

+
public LoggerExt.TException ErrorCorr<TException>(string correlationId, LoggerExt.TException exception, string message = null) where TException: Exception
+Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
+

Return value

net.adamec.lib.common.core.logging.LoggerExt.TException
Pass-through exception
Implements: ILogger.ErrorCorr<TException>(string, ILogger.TException, string)

+

Go to namespaces or types

+

+

LoggerExt.ErrorCorr<TException>(string, string, Exception) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the diagnostic message at the Error level with correlation ID. Creates and returns the exception of given type

+
public LoggerExt.TException ErrorCorr<TException>(string correlationId, string message, Exception innerException = null) where TException: Exception
+Type parameters
TException
+Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
+

Return value

net.adamec.lib.common.core.logging.LoggerExt.TException
Created exception
Implements: ILogger.ErrorCorr<TException>(string, string, Exception)

+

Go to namespaces or types

+

+

LoggerExt.ErrorFltr<TException>(LoggerExt.TException, string, bool) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.ExceptionFilter.cs

+

Writes the diagnostic message at the Error level and returns the exception of given type

+
public bool ErrorFltr<TException>(LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception
+Type parameters
TException
+Method parameters
net.adamec.lib.common.core.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+

Return value

bool
Flag whether the exception is to be catch by exception filter
Implements: ILogger.ErrorFltr<TException>(ILogger.TException, string, bool)

+

Example

+

The following code logs any exception without catching it (function returns false by default)

    try
+    {
+      ...
+    }
+    catch (Exception e) when (Logger.FatalFltr(e)) {}
The following code catch and log the ArgumentException and logs any other exception without catching it.
    try
+    {
+      ...
+    }
+    catch (ArgumentException e) when (Logger.ErrorFltr(e,catchIt:true)) {}
+    catch (Exception e) when (Logger.FatalFltr(e)) {}

+

Remarks

+

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

+

Go to namespaces or types

+

+

LoggerExt.ErrorFltrCorr<TException>(string, LoggerExt.TException, string, bool) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the diagnostic message at the Error level and returns the exception of given type

+
public bool ErrorFltrCorr<TException>(string correlationId, LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception
+Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+

Return value

bool
Flag whether the exception is to be catch by exception filter
Implements: ILogger.ErrorFltrCorr<TException>(string, ILogger.TException, string, bool)

+

Remarks

+

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

+

See Also

+

ErrorFltr<TException>(LoggerExt.TException, string, bool)

+

Go to namespaces or types

+

+

LoggerExt.ErrorPassThrough(Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.ExceptionPassThrough.cs

+

Writes the diagnostic message at the Error level and returns given exception

+
public Exception ErrorPassThrough(Exception exception, string message = null)
+Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

System.Exception
Pass-through exception
Implements: ILogger.ErrorPassThrough(Exception, string)

+

Go to namespaces or types

+

+

LoggerExt.Fatal(Dictionary<string,object>, Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.EventProperties.cs

+

Writes the diagnostic message at the Fatal level.

+
public void Fatal(Dictionary<string,object> eventProperties, Exception exception, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

void
Implements: ILogger.Fatal(Dictionary<string,object>, Exception, string)

+

Go to namespaces or types

+

+

LoggerExt.Fatal(Dictionary<string,object>, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.EventProperties.cs

+

Writes the diagnostic message at the Fatal level.

+
public void Fatal(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+

Return value

void
Implements: ILogger.Fatal(Dictionary<string,object>, string)

+

Go to namespaces or types

+

+

LoggerExt.Fatal<TException>(string, Exception) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.ExceptionPassThrough.cs

+

Writes the diagnostic message at the Fatal level. Creates and returns the exception of given type

+
public LoggerExt.TException Fatal<TException>(string message, Exception innerException = null) where TException: Exception
+Type parameters
TException
+Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
+

Return value

net.adamec.lib.common.core.logging.LoggerExt.TException
Created exception
Implements: ILogger.Fatal<TException>(string, Exception)

+

Go to namespaces or types

+

+

LoggerExt.FatalCorr(string, Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the diagnostic message at the Fatal level with correlation ID.

+
public void FatalCorr(string correlationId, Exception exception, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

void
Implements: ILogger.FatalCorr(string, Exception, string)

+

Go to namespaces or types

+

+

LoggerExt.FatalCorr(string, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the diagnostic message at the Fatal level with correlation ID.

+
public void FatalCorr(string correlationId, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
string message
Log message.
+

Return value

void
Implements: ILogger.FatalCorr(string, string)

+

Go to namespaces or types

+

+

LoggerExt.FatalCorr<TException>(string, LoggerExt.TException, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the diagnostic message at the Fatal level and returns the exception of given type

+
public LoggerExt.TException FatalCorr<TException>(string correlationId, LoggerExt.TException exception, string message = null) where TException: Exception
+Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
+

Return value

net.adamec.lib.common.core.logging.LoggerExt.TException
Pass-through exception
Implements: ILogger.FatalCorr<TException>(string, ILogger.TException, string)

+

Go to namespaces or types

+

+

LoggerExt.FatalCorr<TException>(string, string, Exception) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the diagnostic message at the Fatal level with correlation ID. Creates and returns the exception of given type

+
public LoggerExt.TException FatalCorr<TException>(string correlationId, string message, Exception innerException = null) where TException: Exception
+Type parameters
TException
+Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
+

Return value

net.adamec.lib.common.core.logging.LoggerExt.TException
Created exception
Implements: ILogger.FatalCorr<TException>(string, string, Exception)

+

Go to namespaces or types

+

+

LoggerExt.FatalFltr<TException>(LoggerExt.TException, string, bool) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.ExceptionFilter.cs

+

Writes the diagnostic message at the Fatal level and returns catchIt value.

+
public bool FatalFltr<TException>(LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception
+Type parameters
TException
+Method parameters
net.adamec.lib.common.core.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+

Return value

bool
Flag whether the exception is to be catch by exception filter
Implements: ILogger.FatalFltr<TException>(ILogger.TException, string, bool)

+

Remarks

+

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

+

See Also

+

ErrorFltr<TException>(LoggerExt.TException, string, bool)

+

Go to namespaces or types

+

+

LoggerExt.FatalFltrCorr<TException>(string, LoggerExt.TException, string, bool) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the diagnostic message at the Fatal level and returns catchIt value.

+
public bool FatalFltrCorr<TException>(string correlationId, LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception
+Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+

Return value

bool
Flag whether the exception is to be catch by exception filter
Implements: ILogger.FatalFltrCorr<TException>(string, ILogger.TException, string, bool)

+

Remarks

+

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

+

See Also

+

ErrorFltr<TException>(LoggerExt.TException, string, bool)

+

Go to namespaces or types

+

+

LoggerExt.FatalPassThrough(Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.ExceptionPassThrough.cs

+

Writes the diagnostic message at the Fatal level and returns given exception >

+
public Exception FatalPassThrough(Exception exception, string message = null)
+Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

System.Exception
Pass-through exception
Implements: ILogger.FatalPassThrough(Exception, string)

+

Go to namespaces or types

+

+

LoggerExt.Info(Dictionary<string,object>, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.EventProperties.cs

+

Writes the diagnostic message at the Info level.

+
public void Info(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+

Return value

void
Implements: ILogger.Info(Dictionary<string,object>, string)

+

Go to namespaces or types

+

+

LoggerExt.InfoCorr(string, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the diagnostic message at the Info level with correlation ID.

+
public void InfoCorr(string correlationId, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
string message
Log message.
+

Return value

void
Implements: ILogger.InfoCorr(string, string)

+

Go to namespaces or types

+

+

LoggerExt.LogIt(LogLevel, Dictionary<string,object>, string, Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.cs

+

Writes the item (message with optional event properties and exception) into the log

+
private void LogIt(LogLevel level, Dictionary<string,object> eventProperties, [Localizable(false)] string message, Exception exception = null, string stackTrace = null)
+Method parameters
NLog.LogLevel level
Dictionary<string,object> eventProperties
Event properties (null when no properties are provided)
string message
Log message
System.Exception exception
Optional exception to be logged
string stackTrace
Optional stack trace to be logged in StackTrace event property when the System.Exception.StackTrace of exception is empty
+

Return value

void

+

Go to namespaces or types

+

+

LoggerExt.LogIt(LogLevel, string, Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.cs

+

Writes the item (message with optional exception) into the log

+
private void LogIt(LogLevel level, [Localizable(false)] string message, Exception exception = null, string stackTrace = null)
+Method parameters
NLog.LogLevel level
string message
Log message
System.Exception exception
Optional exception to be logged
string stackTrace
Optional stack trace to be logged in StackTrace event property when the System.Exception.StackTrace of exception is empty
+

Return value

void

+

Go to namespaces or types

+

+

LoggerExt.LogIt(LogLevel, string, string, Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the item (message with optional exception) with correlation Id into the log

+
private void LogIt(LogLevel level, string correlationId, [Localizable(false)] string message, Exception exception = null, string stackTrace = null)
+Method parameters
NLog.LogLevel level
string correlationId
Correlation ID
string message
Log message
System.Exception exception
Optional exception to be logged
string stackTrace
Optional stack trace to be logged in StackTrace event property when the System.Exception.StackTrace of exception is empty
+

Return value

void

+

Go to namespaces or types

+

+

LoggerExt.Trace(Dictionary<string,object>, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.EventProperties.cs

+

Writes the diagnostic message at the Trace level.

+
public void Trace(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+

Return value

void
Implements: ILogger.Trace(Dictionary<string,object>, string)

+

Go to namespaces or types

+

+

LoggerExt.TraceCorr(string, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the diagnostic message at the Trace level with correlation ID

+
public void TraceCorr(string correlationId, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
string message
Log message.
+

Return value

void
Implements: ILogger.TraceCorr(string, string)

+

Go to namespaces or types

+

+

LoggerExt.Warn(Dictionary<string,object>, Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.EventProperties.cs

+

Writes the diagnostic message at the Warn level.

+
public void Warn(Dictionary<string,object> eventProperties, Exception exception, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

void
Implements: ILogger.Warn(Dictionary<string,object>, Exception, string)

+

Go to namespaces or types

+

+

LoggerExt.Warn(Dictionary<string,object>, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.EventProperties.cs

+

Writes the diagnostic message at the Warn level.

+
public void Warn(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+

Return value

void
Implements: ILogger.Warn(Dictionary<string,object>, string)

+

Go to namespaces or types

+

+

LoggerExt.WarnCorr(string, Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the diagnostic message at the Warn level with correlation ID.

+
public void WarnCorr(string correlationId, Exception exception, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

void
Implements: ILogger.WarnCorr(string, Exception, string)

+

Go to namespaces or types

+

+

LoggerExt.WarnCorr(string, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: LoggerExt
+Sources: logging\LoggerExt.CorrelationId.cs

+

Writes the diagnostic message at the Warn level with correlation ID.

+
public void WarnCorr(string correlationId, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
string message
Log message.
+

Return value

void
Implements: ILogger.WarnCorr(string, string)

+

Go to namespaces or types

+

+

ILogger Interface

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Sources: logging\ILogger.CorrelationId.cs, logging\ILogger.cs, logging\ILogger.EventProperties.cs, logging\ILogger.ExceptionFilter.cs, logging\ILogger.ExceptionPassThrough.cs

+

Logger interface - wrapper around the NLog.ILogger with some additional methods

+
public interface ILogger : ILogger
+

Implemented by: net.adamec.lib.common.core.logging.LoggerExt
+Implements: NLog.ILogger, NLog.ILoggerBase, NLog.ISuppress

+

Remarks

+

The NLog supports having additional (custom) event properties provided to loggers and optionally rendered to logs. The event properties are represented as key-value dictionary, where key is the unique name of the property.

Extended logger provides following methods to log with given set of the properties.

+ + + +

Sometimes, it's useful to have an exception logging method implemented as the operation returning the exception being logged. The ErrorPassThrough(Exception, string) and FatalPassThrough(Exception, string) methods will log given exception and return it for further processing.

    try
+    {
+      ...
+    }
+    catch (Exception ex){
+       if(logger.ErrorPassThrough(ex) is MyException){
+         return null;
+       }else{
+         throw;
+       } 
+    }
In the example above, the exception is always logged and then the decision/action is taken.

C# 6 brought the exception filters that don't unwind the stack as the exception is not catch yet when processing the filter. It can also be used for logging the exceptions without actually catching them (when the exception filter returns false ). Extended logger provides functions ErrorFltr<TException>(ILogger.TException, string, bool) and FatalFltr<TException>(ILogger.TException, string, bool) for this purpose.

    try
+    {
+      ...
+    }
+    catch (Exception ex) when (logger.ErrorFltr(ex,"Error here!"){
+      //newer called as the default return value of ErrorFltr is false     
+    }
The example above logs but never catch all exceptions. The following code catch and log the ArgumentException and logs any other exception without catching it.
    try
+    {
+      ...
+    }
+    catch (ArgumentException e) when (Logger.ErrorFltr(e,catchIt:true)) { ... }
+    catch (Exception e) when (Logger.FatalFltr(e)) {}

Logger can also create and exception, log it and return using functions Error<TException>(string, Exception) and Fatal<TException>(string, Exception)

    if(value is null) throw logger.Fatal<ArgumentNullException>("Value is null");

When logging an exception using the LoggerExt methods, the event property StackTrace is set from System.Exception.StackTrace , when the logger creates an exception, the property is set using new StackTrace(2, true).ToString() . In other cases when the System.Exception.StackTrace is null or empty, new StackTrace(true).ToString() is used.

LoggerExt also provides set of methods for logging with the correlation ID (for example in integration scenarios), where the given correlation ID is set to the event property CorrelationId . Such methods have the name ending with Corr suffix.

+

Methods

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameModifierSummary
Debug(Dictionary<string,object>, string)public abstractWrites the diagnostic message at the Debug level.
DebugCorr(string, string)public abstractWrites the diagnostic message at the Debug level with correlation ID.
Error(Dictionary<string,object>, Exception, string)public abstractWrites the diagnostic message at the Error level.
Error(Dictionary<string,object>, string)public abstractWrites the diagnostic message at the Error level.
Error<TException>(string, Exception)public abstractWrites the diagnostic message at the Error level. Creates and returns the exception of given type
ErrorCorr(string, Exception, string)public abstractWrites the diagnostic message at the Error level with correlation ID.
ErrorCorr(string, string)public abstractWrites the diagnostic message at the Error level with correlation ID.
ErrorCorr<TException>(string, ILogger.TException, string)public abstractWrites the diagnostic message at the Error level and returns the exception of given type
ErrorCorr<TException>(string, string, Exception)public abstractWrites the diagnostic message at the Error level with correlation ID. Creates and returns the exception of given type
ErrorFltr<TException>(ILogger.TException, string, bool)public abstractWrites the diagnostic message at the Error level and returns the exception of given type
ErrorFltrCorr<TException>(string, ILogger.TException, string, bool)public abstractWrites the diagnostic message at the Error level and returns the exception of given type
ErrorPassThrough(Exception, string)public abstractWrites the diagnostic message at the Error level and returns given exception
Fatal(Dictionary<string,object>, Exception, string)public abstractWrites the diagnostic message at the Fatal level.
Fatal(Dictionary<string,object>, string)public abstractWrites the diagnostic message at the Fatal level.
Fatal<TException>(string, Exception)public abstractWrites the diagnostic message at the Fatal level. Creates and returns the exception of given type
FatalCorr(string, Exception, string)public abstractWrites the diagnostic message at the Fatal level with correlation ID.
FatalCorr(string, string)public abstractWrites the diagnostic message at the Fatal level with correlation ID.
FatalCorr<TException>(string, ILogger.TException, string)public abstractWrites the diagnostic message at the Fatal level and returns the exception of given type
FatalCorr<TException>(string, string, Exception)public abstractWrites the diagnostic message at the Fatal level with correlation ID. Creates and returns the exception of given type
FatalFltr<TException>(ILogger.TException, string, bool)public abstractWrites the diagnostic message at the Fatal level and returns catchIt value.
FatalFltrCorr<TException>(string, ILogger.TException, string, bool)public abstractWrites the diagnostic message at the Fatal level and returns catchIt value.
FatalPassThrough(Exception, string)public abstractWrites the diagnostic message at the Fatal level and returns given exception
Info(Dictionary<string,object>, string)public abstractWrites the diagnostic message at the Info level.
InfoCorr(string, string)public abstractWrites the diagnostic message at the Info level with correlation ID.
Trace(Dictionary<string,object>, string)public abstractWrites the diagnostic message at the Trace level.
TraceCorr(string, string)public abstractWrites the diagnostic message at the Trace level with correlation ID.
Warn(Dictionary<string,object>, Exception, string)public abstractWrites the diagnostic message at the Warn level.
Warn(Dictionary<string,object>, string)public abstractWrites the diagnostic message at the Warn level.
WarnCorr(string, Exception, string)public abstractWrites the diagnostic message at the Warn level with correlation ID.
WarnCorr(string, string)public abstractWrites the diagnostic message at the Warn level with correlation ID.
+

+

Go to namespaces or types

+

+

ILogger.Debug(Dictionary<string,object>, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.EventProperties.cs

+

Writes the diagnostic message at the Debug level.

+
public abstract void Debug(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.DebugCorr(string, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.CorrelationId.cs

+

Writes the diagnostic message at the Debug level with correlation ID.

+
public abstract void DebugCorr(string correlationId, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.Error(Dictionary<string,object>, Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.EventProperties.cs

+

Writes the diagnostic message at the Error level.

+
public abstract void Error(Dictionary<string,object> eventProperties, Exception exception, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.Error(Dictionary<string,object>, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.EventProperties.cs

+

Writes the diagnostic message at the Error level.

+
public abstract void Error(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.Error<TException>(string, Exception) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.ExceptionPassThrough.cs

+

Writes the diagnostic message at the Error level. Creates and returns the exception of given type

+
public abstract ILogger.TException Error<TException>(string message, Exception innerException = null) where TException: Exception
+Type parameters
TException
+Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
+

Return value

net.adamec.lib.common.core.logging.ILogger.TException
Created exception

+

Go to namespaces or types

+

+

ILogger.ErrorCorr(string, Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.CorrelationId.cs

+

Writes the diagnostic message at the Error level with correlation ID.

+
public abstract void ErrorCorr(string correlationId, Exception exception, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.ErrorCorr(string, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.CorrelationId.cs

+

Writes the diagnostic message at the Error level with correlation ID.

+
public abstract void ErrorCorr(string correlationId, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.ErrorCorr<TException>(string, ILogger.TException, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.CorrelationId.cs

+

Writes the diagnostic message at the Error level and returns the exception of given type

+
public abstract ILogger.TException ErrorCorr<TException>(string correlationId, ILogger.TException exception, string message = null) where TException: Exception
+Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
+

Return value

net.adamec.lib.common.core.logging.ILogger.TException
Pass-through exception

+

Go to namespaces or types

+

+

ILogger.ErrorCorr<TException>(string, string, Exception) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.CorrelationId.cs

+

Writes the diagnostic message at the Error level with correlation ID. Creates and returns the exception of given type

+
public abstract ILogger.TException ErrorCorr<TException>(string correlationId, string message, Exception innerException = null) where TException: Exception
+Type parameters
TException
+Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
+

Return value

net.adamec.lib.common.core.logging.ILogger.TException
Created exception

+

Go to namespaces or types

+

+

ILogger.ErrorFltr<TException>(ILogger.TException, string, bool) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.ExceptionFilter.cs

+

Writes the diagnostic message at the Error level and returns the exception of given type

+
public abstract bool ErrorFltr<TException>(ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception
+Type parameters
TException
+Method parameters
net.adamec.lib.common.core.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+

Return value

bool
Flag whether the exception is to be catch by exception filter

+

Example

+

The following code logs any exception without catching it (function returns false by default)

    try
+    {
+      ...
+    }
+    catch (Exception e) when (Logger.FatalFltr(e)) {}
The following code catch and log the ArgumentException and logs any other exception without catching it.
    try
+    {
+      ...
+    }
+    catch (ArgumentException e) when (Logger.ErrorFltr(e,catchIt:true)) {}
+    catch (Exception e) when (Logger.FatalFltr(e)) {}

+

Remarks

+

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

+

Go to namespaces or types

+

+

ILogger.ErrorFltrCorr<TException>(string, ILogger.TException, string, bool) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.CorrelationId.cs

+

Writes the diagnostic message at the Error level and returns the exception of given type

+
public abstract bool ErrorFltrCorr<TException>(string correlationId, ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception
+Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+

Return value

bool
Flag whether the exception is to be catch by exception filter

+

Remarks

+

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

+

See Also

+

ErrorFltr<TException>(ILogger.TException, string, bool)

+

Go to namespaces or types

+

+

ILogger.ErrorPassThrough(Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.ExceptionPassThrough.cs

+

Writes the diagnostic message at the Error level and returns given exception

+
public abstract Exception ErrorPassThrough(Exception exception, string message = null)
+Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

System.Exception
Pass-through exception

+

Go to namespaces or types

+

+

ILogger.Fatal(Dictionary<string,object>, Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.EventProperties.cs

+

Writes the diagnostic message at the Fatal level.

+
public abstract void Fatal(Dictionary<string,object> eventProperties, Exception exception, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.Fatal(Dictionary<string,object>, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.EventProperties.cs

+

Writes the diagnostic message at the Fatal level.

+
public abstract void Fatal(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.Fatal<TException>(string, Exception) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.ExceptionPassThrough.cs

+

Writes the diagnostic message at the Fatal level. Creates and returns the exception of given type

+
public abstract ILogger.TException Fatal<TException>(string message, Exception innerException = null) where TException: Exception
+Type parameters
TException
+Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
+

Return value

net.adamec.lib.common.core.logging.ILogger.TException
Created exception

+

Go to namespaces or types

+

+

ILogger.FatalCorr(string, Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.CorrelationId.cs

+

Writes the diagnostic message at the Fatal level with correlation ID.

+
public abstract void FatalCorr(string correlationId, Exception exception, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.FatalCorr(string, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.CorrelationId.cs

+

Writes the diagnostic message at the Fatal level with correlation ID.

+
public abstract void FatalCorr(string correlationId, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.FatalCorr<TException>(string, ILogger.TException, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.CorrelationId.cs

+

Writes the diagnostic message at the Fatal level and returns the exception of given type

+
public abstract ILogger.TException FatalCorr<TException>(string correlationId, ILogger.TException exception, string message = null) where TException: Exception
+Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
+

Return value

net.adamec.lib.common.core.logging.ILogger.TException
Pass-through exception

+

Go to namespaces or types

+

+

ILogger.FatalCorr<TException>(string, string, Exception) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.CorrelationId.cs

+

Writes the diagnostic message at the Fatal level with correlation ID. Creates and returns the exception of given type

+
public abstract ILogger.TException FatalCorr<TException>(string correlationId, string message, Exception innerException = null) where TException: Exception
+Type parameters
TException
+Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
+

Return value

net.adamec.lib.common.core.logging.ILogger.TException
Created exception

+

Go to namespaces or types

+

+

ILogger.FatalFltr<TException>(ILogger.TException, string, bool) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.ExceptionFilter.cs

+

Writes the diagnostic message at the Fatal level and returns catchIt value.

+
public abstract bool FatalFltr<TException>(ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception
+Type parameters
TException
+Method parameters
net.adamec.lib.common.core.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+

Return value

bool
Flag whether the exception is to be catch by exception filter

+

Remarks

+

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

+

See Also

+

ErrorFltr<TException>(ILogger.TException, string, bool)

+

Go to namespaces or types

+

+

ILogger.FatalFltrCorr<TException>(string, ILogger.TException, string, bool) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.CorrelationId.cs

+

Writes the diagnostic message at the Fatal level and returns catchIt value.

+
public abstract bool FatalFltrCorr<TException>(string correlationId, ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception
+Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+

Return value

bool
Flag whether the exception is to be catch by exception filter

+

Remarks

+

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

+

See Also

+

ErrorFltr<TException>(ILogger.TException, string, bool)

+

Go to namespaces or types

+

+

ILogger.FatalPassThrough(Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.ExceptionPassThrough.cs

+

Writes the diagnostic message at the Fatal level and returns given exception

+
public abstract Exception FatalPassThrough(Exception exception, string message = null)
+Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

System.Exception
Pass-through exception

+

Go to namespaces or types

+

+

ILogger.Info(Dictionary<string,object>, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.EventProperties.cs

+

Writes the diagnostic message at the Info level.

+
public abstract void Info(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.InfoCorr(string, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.CorrelationId.cs

+

Writes the diagnostic message at the Info level with correlation ID.

+
public abstract void InfoCorr(string correlationId, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.Trace(Dictionary<string,object>, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.EventProperties.cs

+

Writes the diagnostic message at the Trace level.

+
public abstract void Trace(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.TraceCorr(string, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.CorrelationId.cs

+

Writes the diagnostic message at the Trace level with correlation ID.

+
public abstract void TraceCorr(string correlationId, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.Warn(Dictionary<string,object>, Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.EventProperties.cs

+

Writes the diagnostic message at the Warn level.

+
public abstract void Warn(Dictionary<string,object> eventProperties, Exception exception, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.Warn(Dictionary<string,object>, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.EventProperties.cs

+

Writes the diagnostic message at the Warn level.

+
public abstract void Warn(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
+Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.WarnCorr(string, Exception, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.CorrelationId.cs

+

Writes the diagnostic message at the Warn level with correlation ID.

+
public abstract void WarnCorr(string correlationId, Exception exception, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

ILogger.WarnCorr(string, string) Method

+

Namespace: net.adamec.lib.common.core.logging
+Assembly: net.adamec.lib.common.core
+Type: ILogger
+Sources: logging\ILogger.CorrelationId.cs

+

Writes the diagnostic message at the Warn level with correlation ID.

+
public abstract void WarnCorr(string correlationId, [Localizable(false)] string message)
+Method parameters
string correlationId
Correlation ID
string message
Log message.
+

Return value

void

+

Go to namespaces or types

+

+

net.adamec.lib.common.core.utils Namespace

+

Classes

+ + +
NameModifierSummary
BaseDisposablepublic abstractHelper class for implementation of System.IDisposable types
+

+

Go to namespaces or types

+

+

BaseDisposable Class

+

Namespace: net.adamec.lib.common.core.utils
+Assembly: net.adamec.lib.common.core
+Sources: utils\BaseDisposable.cs

+

Helper class for implementation of System.IDisposable types

+
public abstract class BaseDisposable : IDisposable
+

Inheritance: object
+Implements: IDisposable

+

Constants

+ + +
NameValueSummary
DisposedFlag1Internal flag whether the object is fully disposed
+

+

Fields

+ + + + +
NameModifierSummary
isDisposedprivateThe object is disposed when equals to DisposedFlag
isManagedDisposedprivateThe managed resources are disposed when equals to DisposedFlag
isNativeDisposedprivateThe native resources are disposed when equals to DisposedFlag
+

+

Properties

+ + + + +
NameModifierSummary
DisposedpublicReturns
true
when the object is fully disposed
DisposedManagedpublicReturns
true
when the managed resources are disposed
DisposedNativepublicReturns
true
when the native resources are disposed
+

+

Destructor

+ + +
NameModifierSummary
~BaseDisposable()protected
+

+

Methods

+ + + + + + +
NameModifierSummary
AssertNotDisposed(string)protectedThrows an System.ObjectDisposedException when the current object is disposed
Dispose()publicDispose the object
Dispose(bool)protectedInternal implementation of dispose - free the managed and native resources using the respective methods
DisposeManaged()protectedDispose any disposable managed fields or properties.
DisposeNative()protectedDispose of COM objects, Handles, etc. Then set those objects to null.
+

+

Go to namespaces or types

+

+

BaseDisposable.DisposedFlag Constant

+

Namespace: net.adamec.lib.common.core.utils
+Assembly: net.adamec.lib.common.core
+Type: BaseDisposable
+Sources: utils\BaseDisposable.cs

+

Internal flag whether the object is fully disposed

+
private const int DisposedFlag = 1
+

Field value

int

+

Go to namespaces or types

+

+

BaseDisposable.isDisposed Field

+

Namespace: net.adamec.lib.common.core.utils
+Assembly: net.adamec.lib.common.core
+Type: BaseDisposable
+Sources: utils\BaseDisposable.cs

+

The object is disposed when equals to DisposedFlag

+
private int isDisposed
+

Field value

int

+

Go to namespaces or types

+

+

BaseDisposable.isManagedDisposed Field

+

Namespace: net.adamec.lib.common.core.utils
+Assembly: net.adamec.lib.common.core
+Type: BaseDisposable
+Sources: utils\BaseDisposable.cs

+

The managed resources are disposed when equals to DisposedFlag

+
private int isManagedDisposed
+

Field value

int

+

Go to namespaces or types

+

+

BaseDisposable.isNativeDisposed Field

+

Namespace: net.adamec.lib.common.core.utils
+Assembly: net.adamec.lib.common.core
+Type: BaseDisposable
+Sources: utils\BaseDisposable.cs

+

The native resources are disposed when equals to DisposedFlag

+
private int isNativeDisposed
+

Field value

int

+

Go to namespaces or types

+

+

BaseDisposable.Disposed Property

+

Namespace: net.adamec.lib.common.core.utils
+Assembly: net.adamec.lib.common.core
+Type: BaseDisposable
+Sources: utils\BaseDisposable.cs

+

Returns

true
when the object is fully disposed

+
public bool Disposed { get; }
+

Property value

bool

+

Go to namespaces or types

+

+

BaseDisposable.DisposedManaged Property

+

Namespace: net.adamec.lib.common.core.utils
+Assembly: net.adamec.lib.common.core
+Type: BaseDisposable
+Sources: utils\BaseDisposable.cs

+

Returns

true
when the managed resources are disposed

+
public bool DisposedManaged { get; }
+

Property value

bool

+

Go to namespaces or types

+

+

BaseDisposable.DisposedNative Property

+

Namespace: net.adamec.lib.common.core.utils
+Assembly: net.adamec.lib.common.core
+Type: BaseDisposable
+Sources: utils\BaseDisposable.cs

+

Returns

true
when the native resources are disposed

+
public bool DisposedNative { get; }
+

Property value

bool

+

Go to namespaces or types

+

+

BaseDisposable.~BaseDisposable() Destructor

+

Namespace: net.adamec.lib.common.core.utils
+Assembly: net.adamec.lib.common.core
+Type: BaseDisposable
+Sources: utils\BaseDisposable.cs

+
 ~BaseDisposable()
+

Go to namespaces or types

+

+

BaseDisposable.AssertNotDisposed(string) Method

+

Namespace: net.adamec.lib.common.core.utils
+Assembly: net.adamec.lib.common.core
+Type: BaseDisposable
+Sources: utils\BaseDisposable.cs

+

Throws an System.ObjectDisposedException when the current object is disposed

+
protected void AssertNotDisposed(string message = null)
+Method parameters
string message
Optional exception message
+

Return value

void

+

Exceptions

+

System.ObjectDisposedException
Current object is disposed

+

Go to namespaces or types

+

+

BaseDisposable.Dispose() Method

+

Namespace: net.adamec.lib.common.core.utils
+Assembly: net.adamec.lib.common.core
+Type: BaseDisposable
+Sources: utils\BaseDisposable.cs

+

Dispose the object

+
public void Dispose()
+

Return value

void
Implements: IDisposable.Dispose

+

Go to namespaces or types

+

+

BaseDisposable.Dispose(bool) Method

+

Namespace: net.adamec.lib.common.core.utils
+Assembly: net.adamec.lib.common.core
+Type: BaseDisposable
+Sources: utils\BaseDisposable.cs

+

Internal implementation of dispose - free the managed and native resources using the respective methods

+
protected virtual void Dispose(bool disposing)
+Method parameters
bool disposing
True to dispose both managed and native resources, false to dispose the native resources only
+

Return value

void

+

Go to namespaces or types

+

+

BaseDisposable.DisposeManaged() Method

+

Namespace: net.adamec.lib.common.core.utils
+Assembly: net.adamec.lib.common.core
+Type: BaseDisposable
+Sources: utils\BaseDisposable.cs

+

Dispose any disposable managed fields or properties.

+
protected virtual void DisposeManaged()
+

Return value

void

+

Go to namespaces or types

+

+

BaseDisposable.DisposeNative() Method

+

Namespace: net.adamec.lib.common.core.utils
+Assembly: net.adamec.lib.common.core
+Type: BaseDisposable
+Sources: utils\BaseDisposable.cs

+

Dispose of COM objects, Handles, etc. Then set those objects to null.

+
protected virtual void DisposeNative()
+

Return value

void

+

Go to namespaces or types

+

+ diff --git a/doc/net.adamec.lib.common.core.md b/doc/net.adamec.lib.common.core.md new file mode 100644 index 0000000..7365f4d --- /dev/null +++ b/doc/net.adamec.lib.common.core.md @@ -0,0 +1,3171 @@ +# Documentation # +## Namespaces ## + + | Name | Summary | + | ------ | --------- | + | [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) | | + | [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) | | + | [net.adamec.lib.common.core.utils](#n-net.adamec.lib.common.core.utils__1ltknbs) | | + +## Types ## + + | Name | Modifier | Kind | Summary | + | ------ | ---------- | ------ | --------- | + | [BaseDisposable](#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) | public abstract | Class | Helper class for implementation of System.IDisposable types | + | [CommonLogging](#t-net.adamec.lib.common.core.logging.commonlogging__1x32qka) | public static | Class | [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) factory | + | [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) | public | Class | Singleton holding the application configuration (options) | + | [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6) | public | Class | Configuration builder providing the methods for adding the configuration items from individual sources | + | [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) | public | Class | Extended logger implementing [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) | + | [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) | public abstract | Interface | Logger interface - wrapper around the NLog.ILogger with some additional methods | + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## net.adamec.lib.common.core.config Namespace ## +### Classes ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) | public | Singleton holding the application configuration (options) | + | [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6) | public | Configuration builder providing the methods for adding the configuration items from individual sources | + + + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration Class ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Sources: config\Configuration.cs + + +Singleton holding the application configuration (options) + + + +```csharp +public sealed class Configuration +``` + +Inheritance: object + + + +### Remarks ### +This is the simple configuration container in case DI with more sophisticated containers is not used The configuration is stored as the key-value dictionary, supporting hierarchy using the dot separator and arrays.The arrays can contain values or another objects. Actually, mixed arrays of values and objects can be stored, but they are not supported for binding. For example `section1.option1` means the option1 available in section1, `section1.subSection2.option1` means the option1 available in section1.subSection2. `section1.option1[0]` means, that the option1 is array of values or objects (sections) within the section1. For arrays, the keys are like `OtherSection.SimpleArray[0]` or `OtherSection.ComplexObjectArray[0].Name` + + [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) class provides a singleton instance, however the key functionality is provided via static functions, so no need to touch the [Instance](#p-net.adamec.lib.common.core.config.configuration.instance__svsil0) at all. The items can be retrieved by key using the [Get(string)](#m-net.adamec.lib.common.core.config.configuration.get_system.string___18gsgyv) and [Get<TValueType>(string, Configuration.TValueType)](#m-net.adamec.lib.common.core.config.configuration.get--1_system.string---0___5k6md0) methods. The first one returns null when the key is not found, the other one allow to define the default value to be returned, when the item is not found. + + The inner class [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6) provides the methods to build the configuration from JSON config files, commandline arguments, environment values and/or direct entries. The static method [Builder()](#m-net.adamec.lib.common.core.config.configuration.builder__8hz4rf) clears the configuration items and binding cache and creates a new instance of [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6) allowing to build a configuration from scratch. The configuration is updated directly during the calls to builder methods, the existing items (keys) are updated, so it's possible to manage the priority of individual sources and the overrides if needed. The method [Build()](#m-net.adamec.lib.common.core.config.configuration.configurationbuilder.build__1runkhj) returns the configuration instance, breaking the fluent design of builder methods, however there is no other functionality within the method, so it's more the convention than need to use it at the end of configuration build. + + Configuration binding it the way, how to access the configuration using the configuration objects instead of querying the individual items by key. When the method [Bind<TOptionsContainer>(string, bool)](#m-net.adamec.lib.common.core.config.configuration.bind--1_system.string-system.boolean___989gee) is used, it creates a new instance of given type and tries to map the public properties with public setter to the keys (using the "dot notation") within the [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) . It's possible to bind the object to to the root of the configuration to provide the whole configuration at once or bind it to the particular section to provide a configuration sub-tree. In general, the nested objects and both value and object arrays are supported. There are some rules when binding the arrays: The index must start with zero and must be in sequence (the first non-existing index stops the evaluation). The array should not mix the array or values and array of objects. The decision is made at the first item (index=0) whether it's value or object. + + The implementation of binding treats the System.Boolean values the special way - if there is no value, but existing key, the value is converted to true. This is useful when the command line arguments are used like flags. For example having the argument `-p:SkipStep1` and prefix `-p:` , the binding a bool property `SkipStep1` will set the value of the property to `true` (doesn't change the configuration item itself). Of course, it's still possible to use the syntax `-p:SkipStep1=true` or `-p:SkipStep1=false` even in this case. + + As the binding uses the reflection, it's quite expensive operation, so by default, the bound objects are cached (the cache key is the type of bound object, so binding the same type to different sections is not recommended ). It's possible to force the binding using the parameter of [Bind<TOptionsContainer>(string, bool)](#m-net.adamec.lib.common.core.config.configuration.bind--1_system.string-system.boolean___989gee) method. In general, the recommended pattern is to [Bind<TOptionsContainer>(string, bool)](#m-net.adamec.lib.common.core.config.configuration.bind--1_system.string-system.boolean___989gee) the configuration object after the configuration is built and then [Retrieve<TOptionsContainer>()](#m-net.adamec.lib.common.core.config.configuration.retrieve--1__12g1h9d) it from the cache when needed. + + + + +### Fields ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [bindingsCache](#f-net.adamec.lib.common.core.config.configuration.bindingscache__1l7sa9v) | private | Cache for bindings. Dictionary of type bound as a key and the bound object as value. | + | [instance](#f-net.adamec.lib.common.core.config.configuration.instance__1ezti22) | private static | Instance of the [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) created when the singleton is first touched | + + + + +### Properties ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [Instance](#p-net.adamec.lib.common.core.config.configuration.instance__svsil0) | public static | Public [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) instance | + | [Items](#p-net.adamec.lib.common.core.config.configuration.items__b4jvtt) | private | Configuration items stored as key-value pairs | + + + + +### Constructors ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [Configuration()](#m-net.adamec.lib.common.core.config.configuration.-cctor__1ooanmi) | private static | Static constructor | + | [Configuration()](#m-net.adamec.lib.common.core.config.configuration.-ctor__doxeb7) | private | Private constructor used to build the singleton instance | + + + + +### Methods ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [AddOrUpdateItem(string, object)](#m-net.adamec.lib.common.core.config.configuration.addorupdateitem_system.string-system.object___zdqimv) | private | Add a new configuration item with given value or updates its value if the key already exists. | + | [Bind(Type, string)](#m-net.adamec.lib.common.core.config.configuration.bind_system.type-system.string___nirsun) | private static | Creates a new object with given type and binds the configuration to its public properties where possible. | + | [Bind<TOptionsContainer>(string, bool)](#m-net.adamec.lib.common.core.config.configuration.bind--1_system.string-system.boolean___989gee) | public static | Binds the configuration to given TOptionsContainer type and returns the bound object of such type. The resulting configuration object is stored to the cache and can be later on retrieved using [Retrieve<TOptionsContainer>()](#m-net.adamec.lib.common.core.config.configuration.retrieve--1__12g1h9d) | + | [Builder()](#m-net.adamec.lib.common.core.config.configuration.builder__8hz4rf) | public static | Clears the configuration items and binding cache and creates a new instance of [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6) | + | [Get(string)](#m-net.adamec.lib.common.core.config.configuration.get_system.string___18gsgyv) | public static | Gets the configuration item by key | + | [Get<TValueType>(string, Configuration.TValueType)](#m-net.adamec.lib.common.core.config.configuration.get--1_system.string---0___5k6md0) | public static | Gets the typed configuration item by key . Returns the default value, that can be provided or is default to given TValueType The function tries to convert the value to TValueType using System.Convert.ChangeType(System.Object,System.Type) if the conversion is not successful, the default is returned. | + | [GetSection(string)](#m-net.adamec.lib.common.core.config.configuration.getsection_system.string___1jts3sw) | private static | Gets the configuration sub-tree that belongs to given section. The keys returned are relative to given section! When the section is not provided, the whole configuration tree is returned. | + | [Retrieve<TOptionsContainer>()](#m-net.adamec.lib.common.core.config.configuration.retrieve--1__12g1h9d) | public static | Retrieves the configuration object of given TOptionsContainer that has been bound and cached before. The new instance of TOptionsContainer is created when the type not found in cache | + | [TryConvertValue(Type, object, object)](#m-net.adamec.lib.common.core.config.configuration.tryconvertvalue_system.type-system.object-system.object-___63jecz) | private static | Tries to convert sourceValue to targetType . The converted values is returned in targetValue out parameter, the result of conversion is the function return value. | + + + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.bindingsCache Field ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) +Sources: config\Configuration.cs + + +Cache for bindings. Dictionary of type bound as a key and the bound object as value. + + + +```csharp +private readonly ConcurrentDictionary bindingsCache +``` + +Field value
System.Collections.Concurrent.ConcurrentDictionary<System.Type,object>
+ + +### Remarks ### +Cache is used to prevent the "expensive" binding operation in case there is no need to refresh the bound configuration object + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.instance Field ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) +Sources: config\Configuration.cs + + +Instance of the [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) created when the singleton is first touched + + + +```csharp +private static readonly Configuration instance +``` + +Field value
[net.adamec.lib.common.core.config.Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9)
+ + +### Remarks ### +Not using the auto-property to have better control, when the instance is created + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +##
Configuration.Instance Property ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) +Sources: config\Configuration.cs + + +Public [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) instance + + + +```csharp +public static Configuration Instance { get; } +``` + +Property value
[net.adamec.lib.common.core.config.Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9)
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +##
Configuration.Items Property ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) +Sources: config\Configuration.cs + + +Configuration items stored as key-value pairs + + + +```csharp +private ConcurrentDictionary Items { get; } +``` + +Property value
System.Collections.Concurrent.ConcurrentDictionary<string,object>
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.Configuration() Constructor ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) +Sources: config\Configuration.cs + + +Static constructor + + + +```csharp +private static Configuration() +``` + +### Remarks ### +Explicit static constructor to tell C# compiler not to mark type as beforefieldinit + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.Configuration() Constructor ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) +Sources: config\Configuration.cs + + +Private constructor used to build the singleton instance + + + +```csharp +private Configuration() +``` + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.AddOrUpdateItem(string, object) Method ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) +Sources: config\Configuration.cs + + +Add a new configuration item with given value or updates its value if the key already exists. + + + +```csharp +private void AddOrUpdateItem(string key, object value) +``` + +Method parameters
string key
Configuration item key
object value
The value to be set for the configuration item
+Return value
void
+ + +### Exceptions ### +
System.ArgumentException
key is null or empty
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.Bind(Type, string) Method ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) +Sources: config\Configuration.cs + + +Creates a new object with given type and binds the configuration to its public properties where possible. + + + +```csharp +private static object Bind(Type type, string sectionName = null) +``` + +Method parameters
System.Type type
Type to bind the configuration to
string sectionName
Optional section to bind
+Return value
object
The instance of type bound to the configuration
+ + +### Remarks ### +This method doesn't use the binding cache + + +### Exceptions ### +
System.ArgumentNullException
type is null
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.Bind<TOptionsContainer>(string, bool) Method ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) +Sources: config\Configuration.cs + + +Binds the configuration to given TOptionsContainer type and returns the bound object of such type. The resulting configuration object is stored to the cache and can be later on retrieved using [Retrieve<TOptionsContainer>()](#m-net.adamec.lib.common.core.config.configuration.retrieve--1__12g1h9d) + + + +```csharp +public static Configuration.TOptionsContainer Bind(string sectionName = null, bool allowCached = true) where TOptionsContainer: new() +``` + +Type parameters
TOptionsContainer
Type to bind the configuration to
+Method parameters
string sectionName
Optional section to bind
bool allowCached
True if the cache of bindings can be used to retrieve existing binding with the same TOptionsContainer and sectionName
+Return value
net.adamec.lib.common.core.config.Configuration.TOptionsContainer
The instance of TOptionsContainer bound to the configuration
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.Builder() Method ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) +Sources: config\Configuration.cs + + +Clears the configuration items and binding cache and creates a new instance of [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6) + + + +```csharp +public static Configuration.ConfigurationBuilder Builder() +``` + +Return value
[net.adamec.lib.common.core.config.Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6)
The instance of [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6)
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +##
Configuration.Get(string) Method ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) +Sources: config\Configuration.cs + + +Gets the configuration item by key + + + +```csharp +public static object Get(string key) +``` + +Method parameters
string key
Key of the configuration item
+Return value
object
Retrieved configuration item value or null if not found (or the configuration item is null itself)
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.Get<TValueType>(string, Configuration.TValueType) Method ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) +Sources: config\Configuration.cs + + +Gets the typed configuration item by key . Returns the default value, that can be provided or is default to given TValueType The function tries to convert the value to TValueType using System.Convert.ChangeType(System.Object,System.Type) if the conversion is not successful, the default is returned. + + + +```csharp +public static Configuration.TValueType Get(string key, Configuration.TValueType defaultValue = null) +``` + +Type parameters
TValueType
The type the value is to be retrieved in
+Method parameters
string key
Key of the configuration item
net.adamec.lib.common.core.config.Configuration.TValueType defaultValue
Optional default value to be returned when the value can't be retrieved of converted
+Return value
net.adamec.lib.common.core.config.Configuration.TValueType
Retrieved configuration item value or defaultValue when it can't be retrieved or converted
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.GetSection(string) Method ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) +Sources: config\Configuration.cs + + +Gets the configuration sub-tree that belongs to given section. The keys returned are relative to given section! When the section is not provided, the whole configuration tree is returned. + + + +```csharp +private static Dictionary GetSection(string sectionName = null) +``` + +Method parameters
string sectionName
Optional name of the section.
+Return value
Dictionary<string,object>
The configuration items that belong to the section with sectionName . The keys in returned dictionary are relative to given section!
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.Retrieve<TOptionsContainer>() Method ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) +Sources: config\Configuration.cs + + +Retrieves the configuration object of given TOptionsContainer that has been bound and cached before. The new instance of TOptionsContainer is created when the type not found in cache + + + +```csharp +public static Configuration.TOptionsContainer Retrieve() where TOptionsContainer: new() +``` + +Type parameters
TOptionsContainer
Type of the configuration class to retrieve from cache
+Return value
net.adamec.lib.common.core.config.Configuration.TOptionsContainer
The instance of TOptionsContainer bound to the configuration or a new instance if not found
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +##
Configuration.TryConvertValue(Type, object, object) Method ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) +Sources: config\Configuration.cs + + +Tries to convert sourceValue to targetType . The converted values is returned in targetValue out parameter, the result of conversion is the function return value. + + + +```csharp +private static bool TryConvertValue(Type targetType, object sourceValue, out object targetValue) +``` + +Method parameters
System.Type targetType
Target (property) type
object sourceValue
Source value as stored in configuration item
object targetValue
sourceValue converted to targetType when the conversion succeeded (return value is true) or source value otherwise
+Return value
bool
The result or conversion. If true, the targetValue can be set to property having targetType
+ + +### Remarks ### +The implementation treats the System.Boolean values the special way - if there is no value, but existing key, the value is converted to true. + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.ConfigurationBuilder Class ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Sources: config\Configuration.cs + + +Configuration builder providing the methods for adding the configuration items from individual sources + + + +```csharp +public class Configuration.ConfigurationBuilder +``` + +Inheritance: object + + + +### Methods ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [Add(string, object)](#m-net.adamec.lib.common.core.config.configuration.configurationbuilder.add_system.string-system.object___awv60h) | public | Add a new configuration item with given value or updates its value if the key already exists. | + | [AddCommandLineArguments(string[])](#m-net.adamec.lib.common.core.config.configuration.configurationbuilder.addcommandlinearguments_system.string_____hzn4jm) | public | Adds the command line arguments starting with prefixes into the [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) . When a configuration item exists, the value is updated. | + | [AddEnvironmentVariables()](#m-net.adamec.lib.common.core.config.configuration.configurationbuilder.addenvironmentvariables__f440e4) | public | Adds all environment variables into the [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) . When a configuration item exists, the value is updated. | + | [AddJsonFile(string, bool, bool)](#m-net.adamec.lib.common.core.config.configuration.configurationbuilder.addjsonfile_system.string-system.boolean-system.boolean___slvwrt) | public | Loads the configuration items from JSON file, keeping the hierarchy of JSON objects (and arrays) When a configuration item exists, the value is updated. | + | [Build()](#m-net.adamec.lib.common.core.config.configuration.configurationbuilder.build__1runkhj) | public | Finishes the configuration building and returns the [Instance](#p-net.adamec.lib.common.core.config.configuration.instance__svsil0) | + + + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.ConfigurationBuilder.Add(string, object) Method ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6) +Sources: config\Configuration.cs + + +Add a new configuration item with given value or updates its value if the key already exists. + + + +```csharp +public Configuration.ConfigurationBuilder Add(string key, object value) +``` + +Method parameters
string key
Configuration item key
object value
The value to be set for the configuration item
+Return value
[net.adamec.lib.common.core.config.Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6)
The current [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6)
+ + +### Exceptions ### +
System.ArgumentException
key is null or empty
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.ConfigurationBuilder.AddCommandLineArguments(string[]) Method ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6) +Sources: config\Configuration.cs + + +Adds the command line arguments starting with prefixes into the [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) . When a configuration item exists, the value is updated. + + + +```csharp +public Configuration.ConfigurationBuilder AddCommandLineArguments(params string[] prefixes) +``` + +Method parameters
string[] prefixes
Optional list of prefixes marking the command line arguments to be the configuration items
+Return value
[net.adamec.lib.common.core.config.Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6)
The current [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6)
+ + +### Remarks ### +The command line arguments have the syntax `key=value` (for example `Key1=Option1` or `prefixkey=value` (for example `-p:Key1=Option1` where `-p:` is the prefix). When the prefixes are not provided, all command line arguments are added to the configuration. When the prefixes are provided,the prefix is not a part of the key. The implementation of binding treats the System.Boolean values the special way - if there is no value, but existing key, the value is converted to true, allowing to use the parameters like flags. For example having the argument `-p:SkipStep1` and prefix `-p:` , the binding a bool property `SkipStep1` will set the value of the property to `true` (doesn't change the configuration item itself). Of course, it's still possible to use the syntax `-p:SkipStep1=true` or `-p:SkipStep1=false` even in this case. + + + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.ConfigurationBuilder.AddEnvironmentVariables() Method ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6) +Sources: config\Configuration.cs + + +Adds all environment variables into the [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) . When a configuration item exists, the value is updated. + + + +```csharp +public Configuration.ConfigurationBuilder AddEnvironmentVariables() +``` + +Return value
[net.adamec.lib.common.core.config.Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6)
The current [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6)
+ + +### Remarks ### +The name of the environment variable is used as a key to the configuration item. Use the "dot notation" in variable names to support the configuration hierarchy. + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +##
Configuration.ConfigurationBuilder.AddJsonFile(string, bool, bool) Method ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6) +Sources: config\Configuration.cs + + +Loads the configuration items from JSON file, keeping the hierarchy of JSON objects (and arrays) When a configuration item exists, the value is updated. + + + +```csharp +public Configuration.ConfigurationBuilder AddJsonFile(string fileName, bool ignoreNullOrEmptyFileName = false, bool ignoreIfNotExist = false) +``` + +Method parameters
string fileName
Name of the JSON file with configuration
bool ignoreNullOrEmptyFileName
If true, the missing file name will not throw the exception and the method just "silently" ends.
bool ignoreIfNotExist
If true, the non existing file will not throw the exception and the method just "silently" ends.
+Return value
[net.adamec.lib.common.core.config.Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6)
The current [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6)
+ + +### Exceptions ### +
System.ArgumentException
fileName is null or empty and ignoreNullOrEmptyFileName is false
System.ArgumentException
fileName doesn't exist and ignoreIfNotExist is false
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## Configuration.ConfigurationBuilder.Build() Method ## +Namespace: [net.adamec.lib.common.core.config](#n-net.adamec.lib.common.core.config__1q6ay5x) +Assembly: net.adamec.lib.common.core +Type: [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.core.config.configuration.configurationbuilder__90jrb6) +Sources: config\Configuration.cs + + +Finishes the configuration building and returns the [Instance](#p-net.adamec.lib.common.core.config.configuration.instance__svsil0) + + + +```csharp +public Configuration Build() +``` + +Return value
[net.adamec.lib.common.core.config.Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9)
The [Configuration](#t-net.adamec.lib.common.core.config.configuration__1akk3r9) singleton
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +##
net.adamec.lib.common.core.logging Namespace ## +### Classes ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [CommonLogging](#t-net.adamec.lib.common.core.logging.commonlogging__1x32qka) | public static | [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) factory | + | [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) | public | Extended logger implementing [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) | + + + + +### Interfaces ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) | public abstract | Logger interface - wrapper around the NLog.ILogger with some additional methods | + + + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## CommonLogging Class ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Sources: logging\CommonLogging.cs + + +[ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) factory + + + +```csharp +public static class CommonLogging +``` + +Inheritance: object + + + +### Methods ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [CreateLogger(string)](#m-net.adamec.lib.common.core.logging.commonlogging.createlogger_system.string___1f44gey) | public static | Creates the logger with given categoryName | + | [CreateLogger(Type)](#m-net.adamec.lib.common.core.logging.commonlogging.createlogger_system.type___1du8p4r) | public static | Creates the logger for given type. The name of the logger will be System.Type.FullName | + | [CreateLogger<T>()](#m-net.adamec.lib.common.core.logging.commonlogging.createlogger--1__53om5m) | public static | Creates the logger for given type. The name of the logger will be System.Type.FullName | + + + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## CommonLogging.CreateLogger(string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [CommonLogging](#t-net.adamec.lib.common.core.logging.commonlogging__1x32qka) +Sources: logging\CommonLogging.cs + + +Creates the logger with given categoryName + + + +```csharp +public static ILogger CreateLogger(string categoryName) +``` + +Method parameters
string categoryName
Name of the logger
+Return value
[net.adamec.lib.common.core.logging.ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h)
Logger instance
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## CommonLogging.CreateLogger(Type) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [CommonLogging](#t-net.adamec.lib.common.core.logging.commonlogging__1x32qka) +Sources: logging\CommonLogging.cs + + +Creates the logger for given type. The name of the logger will be System.Type.FullName + + + +```csharp +public static ILogger CreateLogger(Type type) +``` + +Method parameters
System.Type type
Type to create the logger for
+Return value
[net.adamec.lib.common.core.logging.ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h)
Logger instance
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## CommonLogging.CreateLogger<T>() Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [CommonLogging](#t-net.adamec.lib.common.core.logging.commonlogging__1x32qka) +Sources: logging\CommonLogging.cs + + +Creates the logger for given type. The name of the logger will be System.Type.FullName + + + +```csharp +public static ILogger CreateLogger() +``` + +Type parameters
T
Type to create the logger for
+Return value
[net.adamec.lib.common.core.logging.ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h)
Logger instance
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt Class ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Sources: logging\LoggerExt.CorrelationId.cs, logging\LoggerExt.cs, logging\LoggerExt.EventProperties.cs, logging\LoggerExt.ExceptionFilter.cs, logging\LoggerExt.ExceptionPassThrough.cs + + +Extended logger implementing [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) + + + +```csharp +public class LoggerExt : Logger, ILogger +``` + +Inheritance: object -> NLog.Logger +Implements: [net.adamec.lib.common.core.logging.ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h), NLog.ILogger, NLog.ILoggerBase, NLog.ISuppress + + +### Methods ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [CreateException<TException>(string, string, Exception)](#m-net.adamec.lib.common.core.logging.loggerext.createexception--1_system.string-system.string--system.exception___gv82y9) | private static | Writes the diagnostic message at the `Fatal` level. Creates and returns the exception of given type | + | [Debug(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.loggerext.debug_system.collections.generic.dictionary_system.string-system.object_-system.string___12jvdw5) | public | Writes the diagnostic message at the `Debug` level. | + | [DebugCorr(string, string)](#m-net.adamec.lib.common.core.logging.loggerext.debugcorr_system.string-system.string___1vciqec) | public | Writes the diagnostic message at the `Debug` level with correlation ID. | + | [Error(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.core.logging.loggerext.error_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___13j0xyo) | public | Writes the diagnostic message at the `Error` level. | + | [Error(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.loggerext.error_system.collections.generic.dictionary_system.string-system.object_-system.string___gaullw) | public | Writes the diagnostic message at the `Error` level. | + | [Error<TException>(string, Exception)](#m-net.adamec.lib.common.core.logging.loggerext.error--1_system.string-system.exception___1b66v34) | public | Writes the diagnostic message at the `Error` level. Creates and returns the exception of given type | + | [ErrorCorr(string, Exception, string)](#m-net.adamec.lib.common.core.logging.loggerext.errorcorr_system.string-system.exception-system.string___glh8ib) | public | Writes the diagnostic message at the `Error` level with correlation ID. | + | [ErrorCorr(string, string)](#m-net.adamec.lib.common.core.logging.loggerext.errorcorr_system.string-system.string___1v17zgb) | public | Writes the diagnostic message at the `Error` level with correlation ID. | + | [ErrorCorr<TException>(string, LoggerExt.TException, string)](#m-net.adamec.lib.common.core.logging.loggerext.errorcorr--1_system.string---0-system.string___1u206c2) | public | Writes the diagnostic message at the `Error` level and returns the exception of given type | + | [ErrorCorr<TException>(string, string, Exception)](#m-net.adamec.lib.common.core.logging.loggerext.errorcorr--1_system.string-system.string-system.exception___1u345km) | public | Writes the diagnostic message at the `Error` level with correlation ID. Creates and returns the exception of given type | + | [ErrorFltr<TException>(LoggerExt.TException, string, bool)](#m-net.adamec.lib.common.core.logging.loggerext.errorfltr--1_--0-system.string-system.boolean___urporj) | public | Writes the diagnostic message at the `Error` level and returns the exception of given type | + | [ErrorFltrCorr<TException>(string, LoggerExt.TException, string, bool)](#m-net.adamec.lib.common.core.logging.loggerext.errorfltrcorr--1_system.string---0-system.string-system.boolean___1emqn0t) | public | Writes the diagnostic message at the `Error` level and returns the exception of given type | + | [ErrorPassThrough(Exception, string)](#m-net.adamec.lib.common.core.logging.loggerext.errorpassthrough_system.exception-system.string___1v1x3rv) | public | Writes the diagnostic message at the `Error` level and returns given exception | + | [Fatal(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.core.logging.loggerext.fatal_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___1jocg2c) | public | Writes the diagnostic message at the `Fatal` level. | + | [Fatal(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.loggerext.fatal_system.collections.generic.dictionary_system.string-system.object_-system.string___hi7jxo) | public | Writes the diagnostic message at the `Fatal` level. | + | [Fatal<TException>(string, Exception)](#m-net.adamec.lib.common.core.logging.loggerext.fatal--1_system.string-system.exception___16xajtw) | public | Writes the diagnostic message at the `Fatal` level. Creates and returns the exception of given type | + | [FatalCorr(string, Exception, string)](#m-net.adamec.lib.common.core.logging.loggerext.fatalcorr_system.string-system.exception-system.string___hk8lud) | public | Writes the diagnostic message at the `Fatal` level with correlation ID. | + | [FatalCorr(string, string)](#m-net.adamec.lib.common.core.logging.loggerext.fatalcorr_system.string-system.string___1by18q9) | public | Writes the diagnostic message at the `Fatal` level with correlation ID. | + | [FatalCorr<TException>(string, LoggerExt.TException, string)](#m-net.adamec.lib.common.core.logging.loggerext.fatalcorr--1_system.string---0-system.string___1gzp2nu) | public | Writes the diagnostic message at the `Fatal` level and returns the exception of given type | + | [FatalCorr<TException>(string, string, Exception)](#m-net.adamec.lib.common.core.logging.loggerext.fatalcorr--1_system.string-system.string-system.exception___500x9y) | public | Writes the diagnostic message at the `Fatal` level with correlation ID. Creates and returns the exception of given type | + | [FatalFltr<TException>(LoggerExt.TException, string, bool)](#m-net.adamec.lib.common.core.logging.loggerext.fatalfltr--1_--0-system.string-system.boolean___g4elu9) | public | Writes the diagnostic message at the `Fatal` level and returns catchIt value. | + | [FatalFltrCorr<TException>(string, LoggerExt.TException, string, bool)](#m-net.adamec.lib.common.core.logging.loggerext.fatalfltrcorr--1_system.string---0-system.string-system.boolean___k3oapn) | public | Writes the diagnostic message at the `Fatal` level and returns catchIt value. | + | [FatalPassThrough(Exception, string)](#m-net.adamec.lib.common.core.logging.loggerext.fatalpassthrough_system.exception-system.string___49a9f1) | public | Writes the diagnostic message at the `Fatal` level and returns given exception > | + | [Info(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.loggerext.info_system.collections.generic.dictionary_system.string-system.object_-system.string___134z29q) | public | Writes the diagnostic message at the `Info` level. | + | [InfoCorr(string, string)](#m-net.adamec.lib.common.core.logging.loggerext.infocorr_system.string-system.string___6odg4h) | public | Writes the diagnostic message at the `Info` level with correlation ID. | + | [LogIt(LogLevel, Dictionary<string,object>, string, Exception, string)](#m-net.adamec.lib.common.core.logging.loggerext.logit_nlog.loglevel-system.collections.generic.dictionary_system.string-system.object_-system.string-system.exception-system.string___7kezy9) | private | Writes the item (message with optional event properties and exception) into the log | + | [LogIt(LogLevel, string, Exception, string)](#m-net.adamec.lib.common.core.logging.loggerext.logit_nlog.loglevel-system.string-system.exception-system.string___c50zo8) | private | Writes the item (message with optional exception) into the log | + | [LogIt(LogLevel, string, string, Exception, string)](#m-net.adamec.lib.common.core.logging.loggerext.logit_nlog.loglevel-system.string-system.string-system.exception-system.string___zz7fm8) | private | Writes the item (message with optional exception) with correlation Id into the log | + | [Trace(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.loggerext.trace_system.collections.generic.dictionary_system.string-system.object_-system.string___1s43qmh) | public | Writes the diagnostic message at the `Trace` level. | + | [TraceCorr(string, string)](#m-net.adamec.lib.common.core.logging.loggerext.tracecorr_system.string-system.string___19gcjny) | public | Writes the diagnostic message at the `Trace` level with correlation ID | + | [Warn(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.core.logging.loggerext.warn_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___1l2efzm) | public | Writes the diagnostic message at the `Warn` level. | + | [Warn(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.loggerext.warn_system.collections.generic.dictionary_system.string-system.object_-system.string___1olzpfm) | public | Writes the diagnostic message at the `Warn` level. | + | [WarnCorr(string, Exception, string)](#m-net.adamec.lib.common.core.logging.loggerext.warncorr_system.string-system.exception-system.string___bxfkhp) | public | Writes the diagnostic message at the `Warn` level with correlation ID. | + | [WarnCorr(string, string)](#m-net.adamec.lib.common.core.logging.loggerext.warncorr_system.string-system.string___2mtn55) | public | Writes the diagnostic message at the `Warn` level with correlation ID. | + + + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.CreateException<TException>(string, string, Exception) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.cs + + +Writes the diagnostic message at the `Fatal` level. Creates and returns the exception of given type + + + +```csharp +private static LoggerExt.TException CreateException(string message, out string stackTrace, Exception innerException = null) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string message
Log message.
string stackTrace
Stack trace to be logged in `StackTrace` event property
System.Exception innerException
Exception to be logged
+Return value
net.adamec.lib.common.core.logging.LoggerExt.TException
Created exception
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.Debug(Dictionary<string,object>, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.EventProperties.cs + + +Writes the diagnostic message at the `Debug` level. + + + +```csharp +public void Debug(Dictionary eventProperties, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+Return value
void
Implements: [ILogger.Debug(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.debug_system.collections.generic.dictionary_system.string-system.object_-system.string___1d4086l) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.DebugCorr(string, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the diagnostic message at the `Debug` level with correlation ID. + + + +```csharp +public void DebugCorr(string correlationId, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
string message
Log message.
+Return value
void
Implements: [ILogger.DebugCorr(string, string)](#m-net.adamec.lib.common.core.logging.ilogger.debugcorr_system.string-system.string___1ni5dj8) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.Error(Dictionary<string,object>, Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.EventProperties.cs + + +Writes the diagnostic message at the `Error` level. + + + +```csharp +public void Error(Dictionary eventProperties, Exception exception, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
void
Implements: [ILogger.Error(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___1b3rh4) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.Error(Dictionary<string,object>, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.EventProperties.cs + + +Writes the diagnostic message at the `Error` level. + + + +```csharp +public void Error(Dictionary eventProperties, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+Return value
void
Implements: [ILogger.Error(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.string___mem0ik) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.Error<TException>(string, Exception) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.ExceptionPassThrough.cs + + +Writes the diagnostic message at the `Error` level. Creates and returns the exception of given type + + + +```csharp +public LoggerExt.TException Error(string message, Exception innerException = null) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
+Return value
net.adamec.lib.common.core.logging.LoggerExt.TException
Created exception
Implements: [ILogger.Error<TException>(string, Exception)](#m-net.adamec.lib.common.core.logging.ilogger.error--1_system.string-system.exception___urvjig) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.ErrorCorr(string, Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the diagnostic message at the `Error` level with correlation ID. + + + +```csharp +public void ErrorCorr(string correlationId, Exception exception, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
void
Implements: [ILogger.ErrorCorr(string, Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.errorcorr_system.string-system.exception-system.string___1all5er) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.ErrorCorr(string, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the diagnostic message at the `Error` level with correlation ID. + + + +```csharp +public void ErrorCorr(string correlationId, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
string message
Log message.
+Return value
void
Implements: [ILogger.ErrorCorr(string, string)](#m-net.adamec.lib.common.core.logging.ilogger.errorcorr_system.string-system.string___1w7b7or) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.ErrorCorr<TException>(string, LoggerExt.TException, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the diagnostic message at the `Error` level and returns the exception of given type + + + +```csharp +public LoggerExt.TException ErrorCorr(string correlationId, LoggerExt.TException exception, string message = null) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
+Return value
net.adamec.lib.common.core.logging.LoggerExt.TException
Pass-through exception
Implements: [ILogger.ErrorCorr<TException>(string, ILogger.TException, string)](#m-net.adamec.lib.common.core.logging.ilogger.errorcorr--1_system.string---0-system.string___15rz22y) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.ErrorCorr<TException>(string, string, Exception) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the diagnostic message at the `Error` level with correlation ID. Creates and returns the exception of given type + + + +```csharp +public LoggerExt.TException ErrorCorr(string correlationId, string message, Exception innerException = null) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
+Return value
net.adamec.lib.common.core.logging.LoggerExt.TException
Created exception
Implements: [ILogger.ErrorCorr<TException>(string, string, Exception)](#m-net.adamec.lib.common.core.logging.ilogger.errorcorr--1_system.string-system.string-system.exception___zycwpy) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.ErrorFltr<TException>(LoggerExt.TException, string, bool) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.ExceptionFilter.cs + + +Writes the diagnostic message at the `Error` level and returns the exception of given type + + + +```csharp +public bool ErrorFltr(LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception +``` + +Type parameters
TException
+Method parameters
net.adamec.lib.common.core.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+Return value
bool
Flag whether the exception is to be catch by exception filter
Implements: [ILogger.ErrorFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.core.logging.ilogger.errorfltr--1_--0-system.string-system.boolean___jv4zvb) + + +### Example ### +The following code logs any exception without catching it (function returns false by default) +```csharp + try + { + ... + } + catch (Exception e) when (Logger.FatalFltr(e)) {} +``` + The following code catch and log the ArgumentException and logs any other exception without catching it. +```csharp + try + { + ... + } + catch (ArgumentException e) when (Logger.ErrorFltr(e,catchIt:true)) {} + catch (Exception e) when (Logger.FatalFltr(e)) {} +``` + + + +### Remarks ### +This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.ErrorFltrCorr<TException>(string, LoggerExt.TException, string, bool) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the diagnostic message at the `Error` level and returns the exception of given type + + + +```csharp +public bool ErrorFltrCorr(string correlationId, LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+Return value
bool
Flag whether the exception is to be catch by exception filter
Implements: [ILogger.ErrorFltrCorr<TException>(string, ILogger.TException, string, bool)](#m-net.adamec.lib.common.core.logging.ilogger.errorfltrcorr--1_system.string---0-system.string-system.boolean___cp8skd) + + +### Remarks ### +This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) + + +### See Also ### +[ErrorFltr<TException>(LoggerExt.TException, string, bool)](#m-net.adamec.lib.common.core.logging.loggerext.errorfltr--1_--0-system.string-system.boolean___urporj) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.ErrorPassThrough(Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.ExceptionPassThrough.cs + + +Writes the diagnostic message at the `Error` level and returns given exception + + + +```csharp +public Exception ErrorPassThrough(Exception exception, string message = null) +``` + +Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
System.Exception
Pass-through exception
Implements: [ILogger.ErrorPassThrough(Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.errorpassthrough_system.exception-system.string___1ewxalv) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.Fatal(Dictionary<string,object>, Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.EventProperties.cs + + +Writes the diagnostic message at the `Fatal` level. + + + +```csharp +public void Fatal(Dictionary eventProperties, Exception exception, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
void
Implements: [ILogger.Fatal(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___1mot8ic) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.Fatal(Dictionary<string,object>, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.EventProperties.cs + + +Writes the diagnostic message at the `Fatal` level. + + + +```csharp +public void Fatal(Dictionary eventProperties, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+Return value
void
Implements: [ILogger.Fatal(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.string___1xh403w) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.Fatal<TException>(string, Exception) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.ExceptionPassThrough.cs + + +Writes the diagnostic message at the `Fatal` level. Creates and returns the exception of given type + + + +```csharp +public LoggerExt.TException Fatal(string message, Exception innerException = null) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
+Return value
net.adamec.lib.common.core.logging.LoggerExt.TException
Created exception
Implements: [ILogger.Fatal<TException>(string, Exception)](#m-net.adamec.lib.common.core.logging.ilogger.fatal--1_system.string-system.exception___3m9nac) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.FatalCorr(string, Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the diagnostic message at the `Fatal` level with correlation ID. + + + +```csharp +public void FatalCorr(string correlationId, Exception exception, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
void
Implements: [ILogger.FatalCorr(string, Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.fatalcorr_system.string-system.exception-system.string___zugzl9) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.FatalCorr(string, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the diagnostic message at the `Fatal` level with correlation ID. + + + +```csharp +public void FatalCorr(string correlationId, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
string message
Log message.
+Return value
void
Implements: [ILogger.FatalCorr(string, string)](#m-net.adamec.lib.common.core.logging.ilogger.fatalcorr_system.string-system.string___1iiczh5) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.FatalCorr<TException>(string, LoggerExt.TException, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the diagnostic message at the `Fatal` level and returns the exception of given type + + + +```csharp +public LoggerExt.TException FatalCorr(string correlationId, LoggerExt.TException exception, string message = null) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
+Return value
net.adamec.lib.common.core.logging.LoggerExt.TException
Pass-through exception
Implements: [ILogger.FatalCorr<TException>(string, ILogger.TException, string)](#m-net.adamec.lib.common.core.logging.ilogger.fatalcorr--1_system.string---0-system.string___1h2a4gq) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.FatalCorr<TException>(string, string, Exception) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the diagnostic message at the `Fatal` level with correlation ID. Creates and returns the exception of given type + + + +```csharp +public LoggerExt.TException FatalCorr(string correlationId, string message, Exception innerException = null) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
+Return value
net.adamec.lib.common.core.logging.LoggerExt.TException
Created exception
Implements: [ILogger.FatalCorr<TException>(string, string, Exception)](#m-net.adamec.lib.common.core.logging.ilogger.fatalcorr--1_system.string-system.string-system.exception___12e1fry) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.FatalFltr<TException>(LoggerExt.TException, string, bool) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.ExceptionFilter.cs + + +Writes the diagnostic message at the `Fatal` level and returns catchIt value. + + + +```csharp +public bool FatalFltr(LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception +``` + +Type parameters
TException
+Method parameters
net.adamec.lib.common.core.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+Return value
bool
Flag whether the exception is to be catch by exception filter
Implements: [ILogger.FatalFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.core.logging.ilogger.fatalfltr--1_--0-system.string-system.boolean___1d7c7n5) + + +### Remarks ### +This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) + + +### See Also ### +[ErrorFltr<TException>(LoggerExt.TException, string, bool)](#m-net.adamec.lib.common.core.logging.loggerext.errorfltr--1_--0-system.string-system.boolean___urporj) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.FatalFltrCorr<TException>(string, LoggerExt.TException, string, bool) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the diagnostic message at the `Fatal` level and returns catchIt value. + + + +```csharp +public bool FatalFltrCorr(string correlationId, LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+Return value
bool
Flag whether the exception is to be catch by exception filter
Implements: [ILogger.FatalFltrCorr<TException>(string, ILogger.TException, string, bool)](#m-net.adamec.lib.common.core.logging.ilogger.fatalfltrcorr--1_system.string---0-system.string-system.boolean___b4uopf) + + +### Remarks ### +This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) + + +### See Also ### +[ErrorFltr<TException>(LoggerExt.TException, string, bool)](#m-net.adamec.lib.common.core.logging.loggerext.errorfltr--1_--0-system.string-system.boolean___urporj) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.FatalPassThrough(Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.ExceptionPassThrough.cs + + +Writes the diagnostic message at the `Fatal` level and returns given exception > + + + +```csharp +public Exception FatalPassThrough(Exception exception, string message = null) +``` + +Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
System.Exception
Pass-through exception
Implements: [ILogger.FatalPassThrough(Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.fatalpassthrough_system.exception-system.string___5v7ipp) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.Info(Dictionary<string,object>, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.EventProperties.cs + + +Writes the diagnostic message at the `Info` level. + + + +```csharp +public void Info(Dictionary eventProperties, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+Return value
void
Implements: [ILogger.Info(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.info_system.collections.generic.dictionary_system.string-system.object_-system.string___1w4twda) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.InfoCorr(string, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the diagnostic message at the `Info` level with correlation ID. + + + +```csharp +public void InfoCorr(string correlationId, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
string message
Log message.
+Return value
void
Implements: [ILogger.InfoCorr(string, string)](#m-net.adamec.lib.common.core.logging.ilogger.infocorr_system.string-system.string___1h9q83t) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.LogIt(LogLevel, Dictionary<string,object>, string, Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.cs + + +Writes the item (message with optional event properties and exception) into the log + + + +```csharp +private void LogIt(LogLevel level, Dictionary eventProperties, [Localizable(false)] string message, Exception exception = null, string stackTrace = null) +``` + +Method parameters
NLog.LogLevel level
Dictionary<string,object> eventProperties
Event properties (null when no properties are provided)
string message
Log message
System.Exception exception
Optional exception to be logged
string stackTrace
Optional stack trace to be logged in `StackTrace` event property when the System.Exception.StackTrace of exception is empty
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.LogIt(LogLevel, string, Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.cs + + +Writes the item (message with optional exception) into the log + + + +```csharp +private void LogIt(LogLevel level, [Localizable(false)] string message, Exception exception = null, string stackTrace = null) +``` + +Method parameters
NLog.LogLevel level
string message
Log message
System.Exception exception
Optional exception to be logged
string stackTrace
Optional stack trace to be logged in `StackTrace` event property when the System.Exception.StackTrace of exception is empty
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.LogIt(LogLevel, string, string, Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the item (message with optional exception) with correlation Id into the log + + + +```csharp +private void LogIt(LogLevel level, string correlationId, [Localizable(false)] string message, Exception exception = null, string stackTrace = null) +``` + +Method parameters
NLog.LogLevel level
string correlationId
Correlation ID
string message
Log message
System.Exception exception
Optional exception to be logged
string stackTrace
Optional stack trace to be logged in `StackTrace` event property when the System.Exception.StackTrace of exception is empty
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.Trace(Dictionary<string,object>, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.EventProperties.cs + + +Writes the diagnostic message at the `Trace` level. + + + +```csharp +public void Trace(Dictionary eventProperties, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+Return value
void
Implements: [ILogger.Trace(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.trace_system.collections.generic.dictionary_system.string-system.object_-system.string___k7nqox) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.TraceCorr(string, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the diagnostic message at the `Trace` level with correlation ID + + + +```csharp +public void TraceCorr(string correlationId, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
string message
Log message.
+Return value
void
Implements: [ILogger.TraceCorr(string, string)](#m-net.adamec.lib.common.core.logging.ilogger.tracecorr_system.string-system.string___14lwu26) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.Warn(Dictionary<string,object>, Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.EventProperties.cs + + +Writes the diagnostic message at the `Warn` level. + + + +```csharp +public void Warn(Dictionary eventProperties, Exception exception, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
void
Implements: [ILogger.Warn(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___15qeutm) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.Warn(Dictionary<string,object>, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.EventProperties.cs + + +Writes the diagnostic message at the `Warn` level. + + + +```csharp +public void Warn(Dictionary eventProperties, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+Return value
void
Implements: [ILogger.Warn(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.string___13bvxqi) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.WarnCorr(string, Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the diagnostic message at the `Warn` level with correlation ID. + + + +```csharp +public void WarnCorr(string correlationId, Exception exception, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
void
Implements: [ILogger.WarnCorr(string, Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.warncorr_system.string-system.exception-system.string___s8xk3x) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## LoggerExt.WarnCorr(string, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Sources: logging\LoggerExt.CorrelationId.cs + + +Writes the diagnostic message at the `Warn` level with correlation ID. + + + +```csharp +public void WarnCorr(string correlationId, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
string message
Log message.
+Return value
void
Implements: [ILogger.WarnCorr(string, string)](#m-net.adamec.lib.common.core.logging.ilogger.warncorr_system.string-system.string___98ayxl) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger Interface ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Sources: logging\ILogger.CorrelationId.cs, logging\ILogger.cs, logging\ILogger.EventProperties.cs, logging\ILogger.ExceptionFilter.cs, logging\ILogger.ExceptionPassThrough.cs + + +Logger interface - wrapper around the NLog.ILogger with some additional methods + + + +```csharp +public interface ILogger : ILogger +``` + +Implemented by: [net.adamec.lib.common.core.logging.LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) +Implements: NLog.ILogger, NLog.ILoggerBase, NLog.ISuppress + + +### Remarks ### +The NLog supports having additional (custom) event properties provided to loggers and optionally rendered to logs. The event properties are represented as key-value dictionary, where key is the unique name of the property. Extended logger provides following methods to log with given set of the properties. + + + + + - [Trace(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.trace_system.collections.generic.dictionary_system.string-system.object_-system.string___k7nqox) , + - [Debug(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.debug_system.collections.generic.dictionary_system.string-system.object_-system.string___1d4086l) , + - [Info(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.info_system.collections.generic.dictionary_system.string-system.object_-system.string___1w4twda) , + - [Warn(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.string___13bvxqi) , + - [Error(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.string___mem0ik) , + - [Fatal(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.string___1xh403w) , + - [Warn(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___15qeutm) , + - [Error(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___1b3rh4) and + - [Fatal(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___1mot8ic) + + + + + + Sometimes, it's useful to have an exception logging method implemented as the operation returning the exception being logged. The [ErrorPassThrough(Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.errorpassthrough_system.exception-system.string___1ewxalv) and [FatalPassThrough(Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.fatalpassthrough_system.exception-system.string___5v7ipp) methods will log given exception and return it for further processing. +```csharp + try + { + ... + } + catch (Exception ex){ + if(logger.ErrorPassThrough(ex) is MyException){ + return null; + }else{ + throw; + } + } +``` + In the example above, the exception is always logged and then the decision/action is taken. + + C# 6 brought the exception filters that don't unwind the stack as the exception is not catch yet when processing the filter. It can also be used for logging the exceptions without actually catching them (when the exception filter returns `false` ). Extended logger provides functions [ErrorFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.core.logging.ilogger.errorfltr--1_--0-system.string-system.boolean___jv4zvb) and [FatalFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.core.logging.ilogger.fatalfltr--1_--0-system.string-system.boolean___1d7c7n5) for this purpose. +```csharp + try + { + ... + } + catch (Exception ex) when (logger.ErrorFltr(ex,"Error here!"){ + //newer called as the default return value of ErrorFltr is false + } +``` + The example above logs but never catch all exceptions. The following code catch and log the ArgumentException and logs any other exception without catching it. +```csharp + try + { + ... + } + catch (ArgumentException e) when (Logger.ErrorFltr(e,catchIt:true)) { ... } + catch (Exception e) when (Logger.FatalFltr(e)) {} +``` + + + Logger can also create and exception, log it and return using functions [Error<TException>(string, Exception)](#m-net.adamec.lib.common.core.logging.ilogger.error--1_system.string-system.exception___urvjig) and [Fatal<TException>(string, Exception)](#m-net.adamec.lib.common.core.logging.ilogger.fatal--1_system.string-system.exception___3m9nac) +```csharp + if(value is null) throw logger.Fatal("Value is null"); +``` + + + When logging an exception using the [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) methods, the event property `StackTrace` is set from System.Exception.StackTrace , when the logger creates an exception, the property is set using `new StackTrace(2, true).ToString()` . In other cases when the System.Exception.StackTrace is null or empty, `new StackTrace(true).ToString()` is used. + + [LoggerExt](#t-net.adamec.lib.common.core.logging.loggerext__1aeycix) also provides set of methods for logging with the correlation ID (for example in integration scenarios), where the given correlation ID is set to the event property `CorrelationId` . Such methods have the name ending with `Corr` suffix. + + + + +### Methods ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [Debug(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.debug_system.collections.generic.dictionary_system.string-system.object_-system.string___1d4086l) | public abstract | Writes the diagnostic message at the `Debug` level. | + | [DebugCorr(string, string)](#m-net.adamec.lib.common.core.logging.ilogger.debugcorr_system.string-system.string___1ni5dj8) | public abstract | Writes the diagnostic message at the `Debug` level with correlation ID. | + | [Error(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___1b3rh4) | public abstract | Writes the diagnostic message at the `Error` level. | + | [Error(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.string___mem0ik) | public abstract | Writes the diagnostic message at the `Error` level. | + | [Error<TException>(string, Exception)](#m-net.adamec.lib.common.core.logging.ilogger.error--1_system.string-system.exception___urvjig) | public abstract | Writes the diagnostic message at the `Error` level. Creates and returns the exception of given type | + | [ErrorCorr(string, Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.errorcorr_system.string-system.exception-system.string___1all5er) | public abstract | Writes the diagnostic message at the `Error` level with correlation ID. | + | [ErrorCorr(string, string)](#m-net.adamec.lib.common.core.logging.ilogger.errorcorr_system.string-system.string___1w7b7or) | public abstract | Writes the diagnostic message at the `Error` level with correlation ID. | + | [ErrorCorr<TException>(string, ILogger.TException, string)](#m-net.adamec.lib.common.core.logging.ilogger.errorcorr--1_system.string---0-system.string___15rz22y) | public abstract | Writes the diagnostic message at the `Error` level and returns the exception of given type | + | [ErrorCorr<TException>(string, string, Exception)](#m-net.adamec.lib.common.core.logging.ilogger.errorcorr--1_system.string-system.string-system.exception___zycwpy) | public abstract | Writes the diagnostic message at the `Error` level with correlation ID. Creates and returns the exception of given type | + | [ErrorFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.core.logging.ilogger.errorfltr--1_--0-system.string-system.boolean___jv4zvb) | public abstract | Writes the diagnostic message at the `Error` level and returns the exception of given type | + | [ErrorFltrCorr<TException>(string, ILogger.TException, string, bool)](#m-net.adamec.lib.common.core.logging.ilogger.errorfltrcorr--1_system.string---0-system.string-system.boolean___cp8skd) | public abstract | Writes the diagnostic message at the `Error` level and returns the exception of given type | + | [ErrorPassThrough(Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.errorpassthrough_system.exception-system.string___1ewxalv) | public abstract | Writes the diagnostic message at the `Error` level and returns given exception | + | [Fatal(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___1mot8ic) | public abstract | Writes the diagnostic message at the `Fatal` level. | + | [Fatal(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.string___1xh403w) | public abstract | Writes the diagnostic message at the `Fatal` level. | + | [Fatal<TException>(string, Exception)](#m-net.adamec.lib.common.core.logging.ilogger.fatal--1_system.string-system.exception___3m9nac) | public abstract | Writes the diagnostic message at the `Fatal` level. Creates and returns the exception of given type | + | [FatalCorr(string, Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.fatalcorr_system.string-system.exception-system.string___zugzl9) | public abstract | Writes the diagnostic message at the `Fatal` level with correlation ID. | + | [FatalCorr(string, string)](#m-net.adamec.lib.common.core.logging.ilogger.fatalcorr_system.string-system.string___1iiczh5) | public abstract | Writes the diagnostic message at the `Fatal` level with correlation ID. | + | [FatalCorr<TException>(string, ILogger.TException, string)](#m-net.adamec.lib.common.core.logging.ilogger.fatalcorr--1_system.string---0-system.string___1h2a4gq) | public abstract | Writes the diagnostic message at the `Fatal` level and returns the exception of given type | + | [FatalCorr<TException>(string, string, Exception)](#m-net.adamec.lib.common.core.logging.ilogger.fatalcorr--1_system.string-system.string-system.exception___12e1fry) | public abstract | Writes the diagnostic message at the `Fatal` level with correlation ID. Creates and returns the exception of given type | + | [FatalFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.core.logging.ilogger.fatalfltr--1_--0-system.string-system.boolean___1d7c7n5) | public abstract | Writes the diagnostic message at the `Fatal` level and returns catchIt value. | + | [FatalFltrCorr<TException>(string, ILogger.TException, string, bool)](#m-net.adamec.lib.common.core.logging.ilogger.fatalfltrcorr--1_system.string---0-system.string-system.boolean___b4uopf) | public abstract | Writes the diagnostic message at the `Fatal` level and returns catchIt value. | + | [FatalPassThrough(Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.fatalpassthrough_system.exception-system.string___5v7ipp) | public abstract | Writes the diagnostic message at the `Fatal` level and returns given exception | + | [Info(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.info_system.collections.generic.dictionary_system.string-system.object_-system.string___1w4twda) | public abstract | Writes the diagnostic message at the `Info` level. | + | [InfoCorr(string, string)](#m-net.adamec.lib.common.core.logging.ilogger.infocorr_system.string-system.string___1h9q83t) | public abstract | Writes the diagnostic message at the `Info` level with correlation ID. | + | [Trace(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.trace_system.collections.generic.dictionary_system.string-system.object_-system.string___k7nqox) | public abstract | Writes the diagnostic message at the `Trace` level. | + | [TraceCorr(string, string)](#m-net.adamec.lib.common.core.logging.ilogger.tracecorr_system.string-system.string___14lwu26) | public abstract | Writes the diagnostic message at the `Trace` level with correlation ID. | + | [Warn(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___15qeutm) | public abstract | Writes the diagnostic message at the `Warn` level. | + | [Warn(Dictionary<string,object>, string)](#m-net.adamec.lib.common.core.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.string___13bvxqi) | public abstract | Writes the diagnostic message at the `Warn` level. | + | [WarnCorr(string, Exception, string)](#m-net.adamec.lib.common.core.logging.ilogger.warncorr_system.string-system.exception-system.string___s8xk3x) | public abstract | Writes the diagnostic message at the `Warn` level with correlation ID. | + | [WarnCorr(string, string)](#m-net.adamec.lib.common.core.logging.ilogger.warncorr_system.string-system.string___98ayxl) | public abstract | Writes the diagnostic message at the `Warn` level with correlation ID. | + + + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.Debug(Dictionary<string,object>, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.EventProperties.cs + + +Writes the diagnostic message at the `Debug` level. + + + +```csharp +public abstract void Debug(Dictionary eventProperties, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.DebugCorr(string, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.CorrelationId.cs + + +Writes the diagnostic message at the `Debug` level with correlation ID. + + + +```csharp +public abstract void DebugCorr(string correlationId, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.Error(Dictionary<string,object>, Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.EventProperties.cs + + +Writes the diagnostic message at the `Error` level. + + + +```csharp +public abstract void Error(Dictionary eventProperties, Exception exception, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.Error(Dictionary<string,object>, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.EventProperties.cs + + +Writes the diagnostic message at the `Error` level. + + + +```csharp +public abstract void Error(Dictionary eventProperties, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.Error<TException>(string, Exception) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.ExceptionPassThrough.cs + + +Writes the diagnostic message at the `Error` level. Creates and returns the exception of given type + + + +```csharp +public abstract ILogger.TException Error(string message, Exception innerException = null) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
+Return value
net.adamec.lib.common.core.logging.ILogger.TException
Created exception
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.ErrorCorr(string, Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.CorrelationId.cs + + +Writes the diagnostic message at the `Error` level with correlation ID. + + + +```csharp +public abstract void ErrorCorr(string correlationId, Exception exception, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.ErrorCorr(string, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.CorrelationId.cs + + +Writes the diagnostic message at the `Error` level with correlation ID. + + + +```csharp +public abstract void ErrorCorr(string correlationId, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.ErrorCorr<TException>(string, ILogger.TException, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.CorrelationId.cs + + +Writes the diagnostic message at the `Error` level and returns the exception of given type + + + +```csharp +public abstract ILogger.TException ErrorCorr(string correlationId, ILogger.TException exception, string message = null) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
+Return value
net.adamec.lib.common.core.logging.ILogger.TException
Pass-through exception
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.ErrorCorr<TException>(string, string, Exception) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.CorrelationId.cs + + +Writes the diagnostic message at the `Error` level with correlation ID. Creates and returns the exception of given type + + + +```csharp +public abstract ILogger.TException ErrorCorr(string correlationId, string message, Exception innerException = null) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
+Return value
net.adamec.lib.common.core.logging.ILogger.TException
Created exception
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.ErrorFltr<TException>(ILogger.TException, string, bool) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.ExceptionFilter.cs + + +Writes the diagnostic message at the `Error` level and returns the exception of given type + + + +```csharp +public abstract bool ErrorFltr(ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception +``` + +Type parameters
TException
+Method parameters
net.adamec.lib.common.core.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+Return value
bool
Flag whether the exception is to be catch by exception filter
+ + +### Example ### +The following code logs any exception without catching it (function returns false by default) +```csharp + try + { + ... + } + catch (Exception e) when (Logger.FatalFltr(e)) {} +``` + The following code catch and log the ArgumentException and logs any other exception without catching it. +```csharp + try + { + ... + } + catch (ArgumentException e) when (Logger.ErrorFltr(e,catchIt:true)) {} + catch (Exception e) when (Logger.FatalFltr(e)) {} +``` + + + +### Remarks ### +This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.ErrorFltrCorr<TException>(string, ILogger.TException, string, bool) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.CorrelationId.cs + + +Writes the diagnostic message at the `Error` level and returns the exception of given type + + + +```csharp +public abstract bool ErrorFltrCorr(string correlationId, ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+Return value
bool
Flag whether the exception is to be catch by exception filter
+ + +### Remarks ### +This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) + + +### See Also ### +[ErrorFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.core.logging.ilogger.errorfltr--1_--0-system.string-system.boolean___jv4zvb) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.ErrorPassThrough(Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.ExceptionPassThrough.cs + + +Writes the diagnostic message at the `Error` level and returns given exception + + + +```csharp +public abstract Exception ErrorPassThrough(Exception exception, string message = null) +``` + +Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
System.Exception
Pass-through exception
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.Fatal(Dictionary<string,object>, Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.EventProperties.cs + + +Writes the diagnostic message at the `Fatal` level. + + + +```csharp +public abstract void Fatal(Dictionary eventProperties, Exception exception, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.Fatal(Dictionary<string,object>, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.EventProperties.cs + + +Writes the diagnostic message at the `Fatal` level. + + + +```csharp +public abstract void Fatal(Dictionary eventProperties, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.Fatal<TException>(string, Exception) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.ExceptionPassThrough.cs + + +Writes the diagnostic message at the `Fatal` level. Creates and returns the exception of given type + + + +```csharp +public abstract ILogger.TException Fatal(string message, Exception innerException = null) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
+Return value
net.adamec.lib.common.core.logging.ILogger.TException
Created exception
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.FatalCorr(string, Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.CorrelationId.cs + + +Writes the diagnostic message at the `Fatal` level with correlation ID. + + + +```csharp +public abstract void FatalCorr(string correlationId, Exception exception, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.FatalCorr(string, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.CorrelationId.cs + + +Writes the diagnostic message at the `Fatal` level with correlation ID. + + + +```csharp +public abstract void FatalCorr(string correlationId, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.FatalCorr<TException>(string, ILogger.TException, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.CorrelationId.cs + + +Writes the diagnostic message at the `Fatal` level and returns the exception of given type + + + +```csharp +public abstract ILogger.TException FatalCorr(string correlationId, ILogger.TException exception, string message = null) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
+Return value
net.adamec.lib.common.core.logging.ILogger.TException
Pass-through exception
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.FatalCorr<TException>(string, string, Exception) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.CorrelationId.cs + + +Writes the diagnostic message at the `Fatal` level with correlation ID. Creates and returns the exception of given type + + + +```csharp +public abstract ILogger.TException FatalCorr(string correlationId, string message, Exception innerException = null) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
+Return value
net.adamec.lib.common.core.logging.ILogger.TException
Created exception
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.FatalFltr<TException>(ILogger.TException, string, bool) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.ExceptionFilter.cs + + +Writes the diagnostic message at the `Fatal` level and returns catchIt value. + + + +```csharp +public abstract bool FatalFltr(ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception +``` + +Type parameters
TException
+Method parameters
net.adamec.lib.common.core.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+Return value
bool
Flag whether the exception is to be catch by exception filter
+ + +### Remarks ### +This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) + + +### See Also ### +[ErrorFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.core.logging.ilogger.errorfltr--1_--0-system.string-system.boolean___jv4zvb) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.FatalFltrCorr<TException>(string, ILogger.TException, string, bool) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.CorrelationId.cs + + +Writes the diagnostic message at the `Fatal` level and returns catchIt value. + + + +```csharp +public abstract bool FatalFltrCorr(string correlationId, ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception +``` + +Type parameters
TException
+Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.core.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
+Return value
bool
Flag whether the exception is to be catch by exception filter
+ + +### Remarks ### +This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) + + +### See Also ### +[ErrorFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.core.logging.ilogger.errorfltr--1_--0-system.string-system.boolean___jv4zvb) + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.FatalPassThrough(Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.ExceptionPassThrough.cs + + +Writes the diagnostic message at the `Fatal` level and returns given exception + + + +```csharp +public abstract Exception FatalPassThrough(Exception exception, string message = null) +``` + +Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
System.Exception
Pass-through exception
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.Info(Dictionary<string,object>, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.EventProperties.cs + + +Writes the diagnostic message at the `Info` level. + + + +```csharp +public abstract void Info(Dictionary eventProperties, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.InfoCorr(string, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.CorrelationId.cs + + +Writes the diagnostic message at the `Info` level with correlation ID. + + + +```csharp +public abstract void InfoCorr(string correlationId, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.Trace(Dictionary<string,object>, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.EventProperties.cs + + +Writes the diagnostic message at the `Trace` level. + + + +```csharp +public abstract void Trace(Dictionary eventProperties, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.TraceCorr(string, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.CorrelationId.cs + + +Writes the diagnostic message at the `Trace` level with correlation ID. + + + +```csharp +public abstract void TraceCorr(string correlationId, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.Warn(Dictionary<string,object>, Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.EventProperties.cs + + +Writes the diagnostic message at the `Warn` level. + + + +```csharp +public abstract void Warn(Dictionary eventProperties, Exception exception, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.Warn(Dictionary<string,object>, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.EventProperties.cs + + +Writes the diagnostic message at the `Warn` level. + + + +```csharp +public abstract void Warn(Dictionary eventProperties, [Localizable(false)] string message) +``` + +Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.WarnCorr(string, Exception, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.CorrelationId.cs + + +Writes the diagnostic message at the `Warn` level with correlation ID. + + + +```csharp +public abstract void WarnCorr(string correlationId, Exception exception, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## ILogger.WarnCorr(string, string) Method ## +Namespace: [net.adamec.lib.common.core.logging](#n-net.adamec.lib.common.core.logging__1s55q1k) +Assembly: net.adamec.lib.common.core +Type: [ILogger](#t-net.adamec.lib.common.core.logging.ilogger__pion8h) +Sources: logging\ILogger.CorrelationId.cs + + +Writes the diagnostic message at the `Warn` level with correlation ID. + + + +```csharp +public abstract void WarnCorr(string correlationId, [Localizable(false)] string message) +``` + +Method parameters
string correlationId
Correlation ID
string message
Log message.
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## net.adamec.lib.common.core.utils Namespace ## +### Classes ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [BaseDisposable](#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) | public abstract | Helper class for implementation of System.IDisposable types | + + + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## BaseDisposable Class ## +Namespace: [net.adamec.lib.common.core.utils](#n-net.adamec.lib.common.core.utils__1ltknbs) +Assembly: net.adamec.lib.common.core +Sources: utils\BaseDisposable.cs + + +Helper class for implementation of System.IDisposable types + + + +```csharp +public abstract class BaseDisposable : IDisposable +``` + +Inheritance: object +Implements: IDisposable + + +### Constants ### + + | Name | Value | Summary | + | ------ | ------- | --------- | + | [DisposedFlag](#f-net.adamec.lib.common.core.utils.basedisposable.disposedflag__1062pgs) | 1 | Internal flag whether the object is fully disposed | + + + + +### Fields ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [isDisposed](#f-net.adamec.lib.common.core.utils.basedisposable.isdisposed__n61qq6) | private | The object is disposed when equals to [DisposedFlag](#f-net.adamec.lib.common.core.utils.basedisposable.disposedflag__1062pgs) | + | [isManagedDisposed](#f-net.adamec.lib.common.core.utils.basedisposable.ismanageddisposed__1rksf51) | private | The managed resources are disposed when equals to [DisposedFlag](#f-net.adamec.lib.common.core.utils.basedisposable.disposedflag__1062pgs) | + | [isNativeDisposed](#f-net.adamec.lib.common.core.utils.basedisposable.isnativedisposed__hgch1d) | private | The native resources are disposed when equals to [DisposedFlag](#f-net.adamec.lib.common.core.utils.basedisposable.disposedflag__1062pgs) | + + + + +### Properties ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [Disposed](#p-net.adamec.lib.common.core.utils.basedisposable.disposed__18q7dig) | public | Returns ```csharp true ``` when the object is fully disposed | + | [DisposedManaged](#p-net.adamec.lib.common.core.utils.basedisposable.disposedmanaged__t02rvd) | public | Returns ```csharp true ``` when the managed resources are disposed | + | [DisposedNative](#p-net.adamec.lib.common.core.utils.basedisposable.disposednative__f70w4d) | public | Returns ```csharp true ``` when the native resources are disposed | + + + + +### Destructor ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [~BaseDisposable()](#m-net.adamec.lib.common.core.utils.basedisposable.finalize__1lkn2hc) | protected | | + + + + +### Methods ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [AssertNotDisposed(string)](#m-net.adamec.lib.common.core.utils.basedisposable.assertnotdisposed_system.string___1g7ogfx) | protected | Throws an System.ObjectDisposedException when the current object is disposed | + | [Dispose()](#m-net.adamec.lib.common.core.utils.basedisposable.dispose__mtboxd) | public | Dispose the object | + | [Dispose(bool)](#m-net.adamec.lib.common.core.utils.basedisposable.dispose_system.boolean___1v427g3) | protected | Internal implementation of dispose - free the managed and native resources using the respective methods | + | [DisposeManaged()](#m-net.adamec.lib.common.core.utils.basedisposable.disposemanaged__dm848c) | protected | Dispose any disposable managed fields or properties. | + | [DisposeNative()](#m-net.adamec.lib.common.core.utils.basedisposable.disposenative__10cel2o) | protected | Dispose of COM objects, Handles, etc. Then set those objects to null. | + + + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## BaseDisposable.DisposedFlag Constant ## +Namespace: [net.adamec.lib.common.core.utils](#n-net.adamec.lib.common.core.utils__1ltknbs) +Assembly: net.adamec.lib.common.core +Type: [BaseDisposable](#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) +Sources: utils\BaseDisposable.cs + + +Internal flag whether the object is fully disposed + + + +```csharp +private const int DisposedFlag = 1 +``` + +Field value
int
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## BaseDisposable.isDisposed Field ## +Namespace: [net.adamec.lib.common.core.utils](#n-net.adamec.lib.common.core.utils__1ltknbs) +Assembly: net.adamec.lib.common.core +Type: [BaseDisposable](#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) +Sources: utils\BaseDisposable.cs + + +The object is disposed when equals to [DisposedFlag](#f-net.adamec.lib.common.core.utils.basedisposable.disposedflag__1062pgs) + + + +```csharp +private int isDisposed +``` + +Field value
int
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## BaseDisposable.isManagedDisposed Field ## +Namespace: [net.adamec.lib.common.core.utils](#n-net.adamec.lib.common.core.utils__1ltknbs) +Assembly: net.adamec.lib.common.core +Type: [BaseDisposable](#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) +Sources: utils\BaseDisposable.cs + + +The managed resources are disposed when equals to [DisposedFlag](#f-net.adamec.lib.common.core.utils.basedisposable.disposedflag__1062pgs) + + + +```csharp +private int isManagedDisposed +``` + +Field value
int
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## BaseDisposable.isNativeDisposed Field ## +Namespace: [net.adamec.lib.common.core.utils](#n-net.adamec.lib.common.core.utils__1ltknbs) +Assembly: net.adamec.lib.common.core +Type: [BaseDisposable](#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) +Sources: utils\BaseDisposable.cs + + +The native resources are disposed when equals to [DisposedFlag](#f-net.adamec.lib.common.core.utils.basedisposable.disposedflag__1062pgs) + + + +```csharp +private int isNativeDisposed +``` + +Field value
int
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## BaseDisposable.Disposed Property ## +Namespace: [net.adamec.lib.common.core.utils](#n-net.adamec.lib.common.core.utils__1ltknbs) +Assembly: net.adamec.lib.common.core +Type: [BaseDisposable](#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) +Sources: utils\BaseDisposable.cs + + +Returns +```csharp +true +``` + when the object is fully disposed + + + +```csharp +public bool Disposed { get; } +``` + +Property value
bool
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## BaseDisposable.DisposedManaged Property ## +Namespace: [net.adamec.lib.common.core.utils](#n-net.adamec.lib.common.core.utils__1ltknbs) +Assembly: net.adamec.lib.common.core +Type: [BaseDisposable](#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) +Sources: utils\BaseDisposable.cs + + +Returns +```csharp +true +``` + when the managed resources are disposed + + + +```csharp +public bool DisposedManaged { get; } +``` + +Property value
bool
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## BaseDisposable.DisposedNative Property ## +Namespace: [net.adamec.lib.common.core.utils](#n-net.adamec.lib.common.core.utils__1ltknbs) +Assembly: net.adamec.lib.common.core +Type: [BaseDisposable](#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) +Sources: utils\BaseDisposable.cs + + +Returns +```csharp +true +``` + when the native resources are disposed + + + +```csharp +public bool DisposedNative { get; } +``` + +Property value
bool
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## BaseDisposable.~BaseDisposable() Destructor ## +Namespace: [net.adamec.lib.common.core.utils](#n-net.adamec.lib.common.core.utils__1ltknbs) +Assembly: net.adamec.lib.common.core +Type: [BaseDisposable](#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) +Sources: utils\BaseDisposable.cs + + + +```csharp + ~BaseDisposable() +``` + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## BaseDisposable.AssertNotDisposed(string) Method ## +Namespace: [net.adamec.lib.common.core.utils](#n-net.adamec.lib.common.core.utils__1ltknbs) +Assembly: net.adamec.lib.common.core +Type: [BaseDisposable](#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) +Sources: utils\BaseDisposable.cs + + +Throws an System.ObjectDisposedException when the current object is disposed + + + +```csharp +protected void AssertNotDisposed(string message = null) +``` + +Method parameters
string message
Optional exception message
+Return value
void
+ + +### Exceptions ### +
System.ObjectDisposedException
Current object is disposed
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## BaseDisposable.Dispose() Method ## +Namespace: [net.adamec.lib.common.core.utils](#n-net.adamec.lib.common.core.utils__1ltknbs) +Assembly: net.adamec.lib.common.core +Type: [BaseDisposable](#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) +Sources: utils\BaseDisposable.cs + + +Dispose the object + + + +```csharp +public void Dispose() +``` + +Return value
void
Implements: IDisposable.Dispose + + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## BaseDisposable.Dispose(bool) Method ## +Namespace: [net.adamec.lib.common.core.utils](#n-net.adamec.lib.common.core.utils__1ltknbs) +Assembly: net.adamec.lib.common.core +Type: [BaseDisposable](#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) +Sources: utils\BaseDisposable.cs + + +Internal implementation of dispose - free the managed and native resources using the respective methods + + + +```csharp +protected virtual void Dispose(bool disposing) +``` + +Method parameters
bool disposing
True to dispose both managed and native resources, false to dispose the native resources only
+Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## BaseDisposable.DisposeManaged() Method ## +Namespace: [net.adamec.lib.common.core.utils](#n-net.adamec.lib.common.core.utils__1ltknbs) +Assembly: net.adamec.lib.common.core +Type: [BaseDisposable](#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) +Sources: utils\BaseDisposable.cs + + +Dispose any disposable managed fields or properties. + + + +```csharp +protected virtual void DisposeManaged() +``` + +Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + +## BaseDisposable.DisposeNative() Method ## +Namespace: [net.adamec.lib.common.core.utils](#n-net.adamec.lib.common.core.utils__1ltknbs) +Assembly: net.adamec.lib.common.core +Type: [BaseDisposable](#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) +Sources: utils\BaseDisposable.cs + + +Dispose of COM objects, Handles, etc. Then set those objects to null. + + + +```csharp +protected virtual void DisposeNative() +``` + +Return value
void
+ + +Go to [namespaces](net.adamec.lib.common.core.md#namespace-list) or [types](net.adamec.lib.common.core.md#type-list) + + + + + + diff --git a/doc/net.adamec.lib.common.html b/doc/net.adamec.lib.common.html index 8b2b870..1ec86bd 100644 --- a/doc/net.adamec.lib.common.html +++ b/doc/net.adamec.lib.common.html @@ -38,14 +38,12 @@

Documentation

Namespaces

- -
NameSummary
net.adamec.lib.common.async
net.adamec.lib.common.config
net.adamec.lib.common.di.component
net.adamec.lib.common.di.config
net.adamec.lib.common.di.config.exception
net.adamec.lib.common.di.config.extensions
net.adamec.lib.common.di.postinit
net.adamec.lib.common.extensions
net.adamec.lib.common.logging
net.adamec.lib.common.utils

Types

@@ -55,11 +53,7 @@

Types

AsyncManager.ExclusiveSynchronizationContextprivateClass"Private" synchronization context used to run the async method AutoOptionsAttributepublicClassClass attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI BackgroundWorkerWithSyncCancelpublicClassExecutes an operation on a separate thread with possibility of sync cancel. -BaseDisposablepublic abstractClassHelper class for implementation of System.IDisposable types -CommonLogginginternal staticClassILogger factory ComponentAttributepublicClassMarks the decorated class as a component that will be available from the service locator / component container. -ConfigurationpublicClassSingleton holding the application configuration (options) -Configuration.ConfigurationBuilderpublicClassConfiguration builder providing the methods for adding the configuration items from individual sources ConsoleUtilsinternal staticClassConsole output helpers ContainerBuilderExtensionsinternal staticClassAutofac Autofac.ContainerBuilder extensions ContainerBuilderExtensionsinternal staticClassAutofac Autofac.ContainerBuilder extensions @@ -70,7 +64,6 @@

Types

FileAsyncinternal staticClassAsynchronous text/lines file read methods https://stackoverflow.com/a/13168006 FileUtilsinternal staticClassFile copy utilities IEnumerableExtensionsinternal staticClassSystem.Collections.Generic.IEnumerable`1 extensions -LoggerExtinternalClassExtended logger implementing ILogger MarshalExtinternal staticClassMarshaling helper methods NamedComponentRegistrationAttributepublicClassDefines the registration name and type for named registration (component type will be used if null) PeriodicTaskinternal staticClassHelper class allowing to execute periodic (or one time) scheduled action @@ -87,7 +80,6 @@

Types

StringExtensionsinternal staticClassSystem.String class extensions TxtpublicClassText builder TypeExtensionsinternal staticClassSystem.Type extensions -ILoggerinternal abstractInterfaceLogger interface - wrapper around the NLog.ILogger with some additional methods IScope<TState>internal abstractInterfaceScope interface. ProcessEventHandlerpublicDelegateA ProcessEventHandler is a delegate for process output events. ComponentAttribute.ImplicitRegistrationTypeEnumpublicEnumKind of the implicit component registration @@ -99,8 +91,6 @@

Source-only packages

- @@ -114,9 +104,7 @@

Source-only packages

- -
NameSummary
RadCommons.async.AsyncManagerHelpers for running the async tasks in sync mode and executing sync actions in async mode (Source only package).
RadCommons.async.FileAsyncHelpers for reading text files in async mode (Source only package).
RadCommons.config.ConfigurationSimple configuration container in case DI with more sophisticated containers is not used. Supports the JSON config files, command line arguments - and environment variables as sources and their hierarchy/overrides. The configuration can be used as key-value pairs or bound to objects (Source only package).
RadCommons.di.ComponentRadCommons DI Component - allows to mark and inject the component using the class attributes (Source only package).
RadCommons.di.ConfigRadCommons DI helpers for application configuration (Source only package).
RadCommons.di.PostInitRadCommons DI PostInit - allows to run post init method of component (Source only package).
RadCommons.extensions.StringExtensions.PathsPath manipulation helpers for strings (Source only package).
RadCommons.extensions.StringExtensions.WhitespaceWhitespace manipulation helpers for strings (Source only package).
RadCommons.extensions.TypeExtensions.DefaultValueProvides default value for types (Source only package).
RadCommons.logging.CommonLoggingRadCommons logging wrapper around NLog with some extended functionality (Source only package).
RadCommons.utils.BackgroundWorkerWithSyncCancelExecutes an operation on a separate thread with possibility of sync cancel (Source only package).
RadCommons.utils.BaseDisposableHelper class for implementation of IDisposable types (Source only package).
RadCommons.utils.ConsoleUtilsConsole output utilities (Source only package).
RadCommons.utils.ContextThe runtime "container" for context operations. The context can be both state-less and state-full and it's valid until it's disposed. The current context is accessible via static property Current. @@ -165,8 +153,7 @@

AsyncMa

Fields

- - +
NameModifierSummary
DefaultExceptionHandlerprivate staticDefault exception handler for RunAsync(Action, Action<System.Exception>) . Catches and logs all exceptions during the task execution.
Loggerprivate staticLogger
DefaultExceptionHandlerprivate staticDefault exception handler for RunAsync(Action, Action<System.Exception>) . Catches all exceptions during the task execution.

Methods

@@ -184,22 +171,11 @@

AsyncManager
Sources: async\AsyncManager.cs
Source-only packages: RadCommons.async.AsyncManager

-

Default exception handler for RunAsync(Action, Action<System.Exception>) . Catches and logs all exceptions during the task execution.

+

Default exception handler for RunAsync(Action, Action<System.Exception>) . Catches all exceptions during the task execution.

private static readonly Action<System.Threading.Tasks.Task> DefaultExceptionHandler

Field value

System.Action<System.Threading.Tasks.Task>

Go to namespaces or types or source-only packages

-

AsyncManager.Logger Field

-

Namespace: net.adamec.lib.common.async
-Assembly: net.adamec.lib.common
-Type: AsyncManager
-Sources: async\AsyncManager.cs
-Source-only packages: RadCommons.async.AsyncManager

-

Logger

-
private static readonly ILogger Logger
-

Field value

net.adamec.lib.common.logging.ILogger

-

Go to namespaces or types or source-only packages

-

AsyncManager.RunAsync(Action, Action<System.Exception>) Method

Namespace: net.adamec.lib.common.async
Assembly: net.adamec.lib.common
@@ -477,332 +453,6 @@

Exceptions

System.IO.FileNotFoundException
The file cannot be found, such as when mode is FileMode.Truncate or FileMode.Open, and the file specified by path does not exist. The file must already exist in these modes.
System.IO.IOException
An I/O error, such as specifying FileMode.CreateNew when the file specified by path already exists, occurred.-or-The stream has been closed.
System.Security.SecurityException
The caller does not have the required permission.
System.IO.DirectoryNotFoundException
The specified path is invalid, such as being on an unmapped drive.
System.UnauthorizedAccessException
The access requested is not permitted by the operating system for the specified path , such as when access is Write or ReadWrite and the file or directory is set for read-only access. -or- System.IO.FileOptions.Encrypted is specified for options, but file encryption is not supported on the current platform.
System.ArgumentNullException
path or encoding is null.
System.ArgumentException
path is an empty string (""), contains only white space, or contains one or more invalid characters. -or- path refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in an NTFS environment.
System.NotSupportedException
path refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in a non-NTFS environment.
System.ArgumentOutOfRangeException
bufferSize is negative or zero.-or- mode, access, or share contain an invalid value.
System.IO.PathTooLongException
The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
System.ObjectDisposedException
The stream has been disposed.
System.InvalidOperationException
The reader is currently in use by a previous read operation.

Go to namespaces or types or source-only packages

-

net.adamec.lib.common.config Namespace

-

Classes

- - - -
NameModifierSummary
ConfigurationpublicSingleton holding the application configuration (options)
Configuration.ConfigurationBuilderpublicConfiguration builder providing the methods for adding the configuration items from individual sources
-

-

Go to namespaces or types or source-only packages

-

-

Configuration Class

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Singleton holding the application configuration (options)

-
public sealed class Configuration
-

Inheritance: object
-

-

Remarks

-

This is the simple configuration container in case DI with more sophisticated containers is not used The configuration is stored as the key-value dictionary, supporting hierarchy using the dot separator and arrays.The arrays can contain values or another objects. Actually, mixed arrays of values and objects can be stored, but they are not supported for binding.

For example section1.option1 means the option1 available in section1, section1.subSection2.option1 means the option1 available in section1.subSection2. section1.option1[0] means, that the option1 is array of values or objects (sections) within the section1. For arrays, the keys are like OtherSection.SimpleArray[0] or OtherSection.ComplexObjectArray[0].Name

Configuration class provides a singleton instance, however the key functionality is provided via static functions, so no need to touch the Instance at all. The items can be retrieved by key using the Get(string) and Get<TValueType>(string, Configuration.TValueType) methods. The first one returns null when the key is not found, the other one allow to define the default value to be returned, when the item is not found.

The inner class Configuration.ConfigurationBuilder provides the methods to build the configuration from JSON config files, commandline arguments, environment values and/or direct entries. The static method Builder() clears the configuration items and binding cache and creates a new instance of Configuration.ConfigurationBuilder allowing to build a configuration from scratch. The configuration is updated directly during the calls to builder methods, the existing items (keys) are updated, so it's possible to manage the priority of individual sources and the overrides if needed. The method Build() returns the configuration instance, breaking the fluent design of builder methods, however there is no other functionality within the method, so it's more the convention than need to use it at the end of configuration build.

Configuration binding it the way, how to access the configuration using the configuration objects instead of querying the individual items by key. When the method Bind<TOptionsContainer>(string, bool) is used, it creates a new instance of given type and tries to map the public properties with public setter to the keys (using the "dot notation") within the Configuration . It's possible to bind the object to to the root of the configuration to provide the whole configuration at once or bind it to the particular section to provide a configuration sub-tree. In general, the nested objects and both value and object arrays are supported. There are some rules when binding the arrays: The index must start with zero and must be in sequence (the first non-existing index stops the evaluation). The array should not mix the array or values and array of objects. The decision is made at the first item (index=0) whether it's value or object.

The implementation of binding treats the System.Boolean values the special way - if there is no value, but existing key, the value is converted to true. This is useful when the command line arguments are used like flags. For example having the argument -p:SkipStep1 and prefix -p: , the binding a bool property SkipStep1 will set the value of the property to true (doesn't change the configuration item itself). Of course, it's still possible to use the syntax -p:SkipStep1=true or -p:SkipStep1=false even in this case.

As the binding uses the reflection, it's quite expensive operation, so by default, the bound objects are cached (the cache key is the type of bound object, so binding the same type to different sections is not recommended ). It's possible to force the binding using the parameter of Bind<TOptionsContainer>(string, bool) method. In general, the recommended pattern is to Bind<TOptionsContainer>(string, bool) the configuration object after the configuration is built and then Retrieve<TOptionsContainer>() it from the cache when needed.

-

Fields

- - - -
NameModifierSummary
bindingsCacheprivateCache for bindings. Dictionary of type bound as a key and the bound object as value.
instanceprivate staticInstance of the Configuration created when the singleton is first touched
-

-

Properties

- - - -
NameModifierSummary
Instancepublic staticPublic Configuration instance
ItemsprivateConfiguration items stored as key-value pairs
-

-

Constructors

- - - -
NameModifierSummary
Configuration()private staticStatic constructor
Configuration()privatePrivate constructor used to build the singleton instance
-

-

Methods

- - - - - - - - - - -
NameModifierSummary
AddOrUpdateItem(string, object)privateAdd a new configuration item with given value or updates its value if the key already exists.
Bind(Type, string)private staticCreates a new object with given type and binds the configuration to its public properties where possible.
Bind<TOptionsContainer>(string, bool)public staticBinds the configuration to given TOptionsContainer type and returns the bound object of such type. The resulting configuration object is stored to the cache and can be later on retrieved using Retrieve<TOptionsContainer>()
Builder()public staticClears the configuration items and binding cache and creates a new instance of Configuration.ConfigurationBuilder
Get(string)public staticGets the configuration item by key
Get<TValueType>(string, Configuration.TValueType)public staticGets the typed configuration item by key . Returns the default value, that can be provided or is default to given TValueType The function tries to convert the value to TValueType using System.Convert.ChangeType(System.Object,System.Type) if the conversion is not successful, the default is returned.
GetSection(string)private staticGets the configuration sub-tree that belongs to given section. The keys returned are relative to given section! When the section is not provided, the whole configuration tree is returned.
Retrieve<TOptionsContainer>()public staticRetrieves the configuration object of given TOptionsContainer that has been bound and cached before. The new instance of TOptionsContainer is created when the type not found in cache
TryConvertValue(Type, object, object)private staticTries to convert sourceValue to targetType . The converted values is returned in targetValue out parameter, the result of conversion is the function return value.
-

-

Go to namespaces or types or source-only packages

-

-

Configuration.bindingsCache Field

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Cache for bindings. Dictionary of type bound as a key and the bound object as value.

-
private readonly ConcurrentDictionary<System.Type,object> bindingsCache
-

Field value

System.Collections.Concurrent.ConcurrentDictionary<System.Type,object>

-

Remarks

-

Cache is used to prevent the "expensive" binding operation in case there is no need to refresh the bound configuration object

-

Go to namespaces or types or source-only packages

-

-

Configuration.instance Field

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Instance of the Configuration created when the singleton is first touched

-
private static readonly Configuration instance
-

Field value

net.adamec.lib.common.config.Configuration

-

Remarks

-

Not using the auto-property to have better control, when the instance is created

-

Go to namespaces or types or source-only packages

-

-

Configuration.Instance Property

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Public Configuration instance

-
public static Configuration Instance { get; }
-

Property value

net.adamec.lib.common.config.Configuration

-

Go to namespaces or types or source-only packages

-

-

Configuration.Items Property

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Configuration items stored as key-value pairs

-
private ConcurrentDictionary<string,object> Items { get; }
-

Property value

System.Collections.Concurrent.ConcurrentDictionary<string,object>

-

Go to namespaces or types or source-only packages

-

-

Configuration.Configuration() Constructor

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Static constructor

-
private static Configuration()
-

Remarks

-

Explicit static constructor to tell C# compiler not to mark type as beforefieldinit

-

Go to namespaces or types or source-only packages

-

-

Configuration.Configuration() Constructor

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Private constructor used to build the singleton instance

-
private Configuration()
-

Go to namespaces or types or source-only packages

-

-

Configuration.AddOrUpdateItem(string, object) Method

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Add a new configuration item with given value or updates its value if the key already exists.

-
private void AddOrUpdateItem(string key, object value)
-Method parameters
string key
Configuration item key
object value
The value to be set for the configuration item
-

Return value

void

-

Exceptions

-

System.ArgumentException
key is null or empty

-

Go to namespaces or types or source-only packages

-

-

Configuration.Bind(Type, string) Method

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Creates a new object with given type and binds the configuration to its public properties where possible.

-
private static object Bind(Type type, string sectionName = null)
-Method parameters
System.Type type
Type to bind the configuration to
string sectionName
Optional section to bind
-

Return value

object
The instance of type bound to the configuration

-

Remarks

-

This method doesn't use the binding cache

-

Exceptions

-

System.ArgumentNullException
type is null

-

Go to namespaces or types or source-only packages

-

-

Configuration.Bind<TOptionsContainer>(string, bool) Method

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Binds the configuration to given TOptionsContainer type and returns the bound object of such type. The resulting configuration object is stored to the cache and can be later on retrieved using Retrieve<TOptionsContainer>()

-
public static Configuration.TOptionsContainer Bind<TOptionsContainer>(string sectionName = null, bool allowCached = true) where TOptionsContainer: new()
-Type parameters
TOptionsContainer
Type to bind the configuration to
-Method parameters
string sectionName
Optional section to bind
bool allowCached
True if the cache of bindings can be used to retrieve existing binding with the same TOptionsContainer and sectionName
-

Return value

net.adamec.lib.common.config.Configuration.TOptionsContainer
The instance of TOptionsContainer bound to the configuration

-

Go to namespaces or types or source-only packages

-

-

Configuration.Builder() Method

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Clears the configuration items and binding cache and creates a new instance of Configuration.ConfigurationBuilder

-
public static Configuration.ConfigurationBuilder Builder()
-

Return value

net.adamec.lib.common.config.Configuration.ConfigurationBuilder
The instance of Configuration.ConfigurationBuilder

-

Go to namespaces or types or source-only packages

-

-

Configuration.Get(string) Method

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Gets the configuration item by key

-
public static object Get(string key)
-Method parameters
string key
Key of the configuration item
-

Return value

object
Retrieved configuration item value or null if not found (or the configuration item is null itself)

-

Go to namespaces or types or source-only packages

-

-

Configuration.Get<TValueType>(string, Configuration.TValueType) Method

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Gets the typed configuration item by key . Returns the default value, that can be provided or is default to given TValueType The function tries to convert the value to TValueType using System.Convert.ChangeType(System.Object,System.Type) if the conversion is not successful, the default is returned.

-
public static Configuration.TValueType Get<TValueType>(string key, Configuration.TValueType defaultValue = null)
-Type parameters
TValueType
The type the value is to be retrieved in
-Method parameters
string key
Key of the configuration item
net.adamec.lib.common.config.Configuration.TValueType defaultValue
Optional default value to be returned when the value can't be retrieved of converted
-

Return value

net.adamec.lib.common.config.Configuration.TValueType
Retrieved configuration item value or defaultValue when it can't be retrieved or converted

-

Go to namespaces or types or source-only packages

-

-

Configuration.GetSection(string) Method

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Gets the configuration sub-tree that belongs to given section. The keys returned are relative to given section! When the section is not provided, the whole configuration tree is returned.

-
private static Dictionary<string,object> GetSection(string sectionName = null)
-Method parameters
string sectionName
Optional name of the section.
-

Return value

Dictionary<string,object>
The configuration items that belong to the section with sectionName . The keys in returned dictionary are relative to given section!

-

Go to namespaces or types or source-only packages

-

-

Configuration.Retrieve<TOptionsContainer>() Method

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Retrieves the configuration object of given TOptionsContainer that has been bound and cached before. The new instance of TOptionsContainer is created when the type not found in cache

-
public static Configuration.TOptionsContainer Retrieve<TOptionsContainer>() where TOptionsContainer: new()
-Type parameters
TOptionsContainer
Type of the configuration class to retrieve from cache
-

Return value

net.adamec.lib.common.config.Configuration.TOptionsContainer
The instance of TOptionsContainer bound to the configuration or a new instance if not found

-

Go to namespaces or types or source-only packages

-

-

Configuration.TryConvertValue(Type, object, object) Method

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Tries to convert sourceValue to targetType . The converted values is returned in targetValue out parameter, the result of conversion is the function return value.

-
private static bool TryConvertValue(Type targetType, object sourceValue, out object targetValue)
-Method parameters
System.Type targetType
Target (property) type
object sourceValue
Source value as stored in configuration item
object targetValue
sourceValue converted to targetType when the conversion succeeded (return value is true) or source value otherwise
-

Return value

bool
The result or conversion. If true, the targetValue can be set to property having targetType

-

Remarks

-

The implementation treats the System.Boolean values the special way - if there is no value, but existing key, the value is converted to true.

-

Go to namespaces or types or source-only packages

-

-

Configuration.ConfigurationBuilder Class

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Configuration builder providing the methods for adding the configuration items from individual sources

-
public class Configuration.ConfigurationBuilder
-

Inheritance: object
-

-

Methods

- - - - - - -
NameModifierSummary
Add(string, object)publicAdd a new configuration item with given value or updates its value if the key already exists.
AddCommandLineArguments(string[])publicAdds the command line arguments starting with prefixes into the Configuration . When a configuration item exists, the value is updated.
AddEnvironmentVariables()publicAdds all environment variables into the Configuration . When a configuration item exists, the value is updated.
AddJsonFile(string, bool, bool)publicLoads the configuration items from JSON file, keeping the hierarchy of JSON objects (and arrays) When a configuration item exists, the value is updated.
Build()publicFinishes the configuration building and returns the Instance
-

-

Go to namespaces or types or source-only packages

-

-

Configuration.ConfigurationBuilder.Add(string, object) Method

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration.ConfigurationBuilder
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Add a new configuration item with given value or updates its value if the key already exists.

-
public Configuration.ConfigurationBuilder Add(string key, object value)
-Method parameters
string key
Configuration item key
object value
The value to be set for the configuration item
-

Return value

net.adamec.lib.common.config.Configuration.ConfigurationBuilder
The current Configuration.ConfigurationBuilder

-

Exceptions

-

System.ArgumentException
key is null or empty

-

Go to namespaces or types or source-only packages

-

-

Configuration.ConfigurationBuilder.AddCommandLineArguments(string[]) Method

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration.ConfigurationBuilder
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Adds the command line arguments starting with prefixes into the Configuration . When a configuration item exists, the value is updated.

-
public Configuration.ConfigurationBuilder AddCommandLineArguments(params string[] prefixes)
-Method parameters
string[] prefixes
Optional list of prefixes marking the command line arguments to be the configuration items
-

Return value

net.adamec.lib.common.config.Configuration.ConfigurationBuilder
The current Configuration.ConfigurationBuilder

-

Remarks

-

The command line arguments have the syntax key=value (for example Key1=Option1 or prefixkey=value (for example -p:Key1=Option1 where -p: is the prefix). When the prefixes are not provided, all command line arguments are added to the configuration. When the prefixes are provided,the prefix is not a part of the key.

The implementation of binding treats the System.Boolean values the special way - if there is no value, but existing key, the value is converted to true, allowing to use the parameters like flags. For example having the argument -p:SkipStep1 and prefix -p: , the binding a bool property SkipStep1 will set the value of the property to true (doesn't change the configuration item itself). Of course, it's still possible to use the syntax -p:SkipStep1=true or -p:SkipStep1=false even in this case.

-

Go to namespaces or types or source-only packages

-

-

Configuration.ConfigurationBuilder.AddEnvironmentVariables() Method

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration.ConfigurationBuilder
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Adds all environment variables into the Configuration . When a configuration item exists, the value is updated.

-
public Configuration.ConfigurationBuilder AddEnvironmentVariables()
-

Return value

net.adamec.lib.common.config.Configuration.ConfigurationBuilder
The current Configuration.ConfigurationBuilder

-

Remarks

-

The name of the environment variable is used as a key to the configuration item. Use the "dot notation" in variable names to support the configuration hierarchy.

-

Go to namespaces or types or source-only packages

-

-

Configuration.ConfigurationBuilder.AddJsonFile(string, bool, bool) Method

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration.ConfigurationBuilder
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Loads the configuration items from JSON file, keeping the hierarchy of JSON objects (and arrays) When a configuration item exists, the value is updated.

-
public Configuration.ConfigurationBuilder AddJsonFile(string fileName, bool ignoreNullOrEmptyFileName = false, bool ignoreIfNotExist = false)
-Method parameters
string fileName
Name of the JSON file with configuration
bool ignoreNullOrEmptyFileName
If true, the missing file name will not throw the exception and the method just "silently" ends.
bool ignoreIfNotExist
If true, the non existing file will not throw the exception and the method just "silently" ends.
-

Return value

net.adamec.lib.common.config.Configuration.ConfigurationBuilder
The current Configuration.ConfigurationBuilder

-

Exceptions

-

System.ArgumentException
fileName is null or empty and ignoreNullOrEmptyFileName is false
System.ArgumentException
fileName doesn't exist and ignoreIfNotExist is false

-

Go to namespaces or types or source-only packages

-

-

Configuration.ConfigurationBuilder.Build() Method

-

Namespace: net.adamec.lib.common.config
-Assembly: net.adamec.lib.common
-Type: Configuration.ConfigurationBuilder
-Sources: config\Configuration.cs
-Source-only packages: RadCommons.config.Configuration

-

Finishes the configuration building and returns the Instance

-
public Configuration Build()
-

Return value

net.adamec.lib.common.config.Configuration
The Configuration singleton

-

Go to namespaces or types or source-only packages

-

net.adamec.lib.common.di.component Namespace

Classes

@@ -1479,11 +1129,6 @@

internal static class ServiceCollectionAutoOptionsExtension

Inheritance: object

-

Fields

-
NameModifierSummary
- -
NameModifierSummary
Loggerprivate static
-

Methods

@@ -1492,16 +1137,6 @@

Methods

Go to namespaces or types or source-only packages

-

ServiceCollectionAutoOptionsExtension.Logger Field

-

Namespace: net.adamec.lib.common.di.config.extensions
-Assembly: net.adamec.lib.common
-Type: ServiceCollectionAutoOptionsExtension
-Sources: di\config\extensions\ServiceCollectionAutoOptionsExtension.cs
-Source-only packages: RadCommons.di.Config

-
private static readonly ILogger Logger
-

Field value

net.adamec.lib.common.logging.ILogger

-

Go to namespaces or types or source-only packages

-

ServiceCollectionAutoOptionsExtension.ConfigureAutoOptions(IServiceCollection, IConfiguration, Assembly[]) Method

Namespace: net.adamec.lib.common.di.config.extensions
Assembly: net.adamec.lib.common
@@ -1626,11 +1261,6 @@

internal static class ContainerBuilderExtensions

Inheritance: object

-

Fields

-

NameModifierSummary
ConfigureAutoOptions(IServiceCollection, IConfiguration, Assembly[])public staticScans given assemblies for classes marked with AutoOptionsAttribute and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI
- -
NameModifierSummary
Loggerprivate staticLogger
-

Methods

@@ -1639,17 +1269,6 @@

Methods

Go to namespaces or types or source-only packages

-

ContainerBuilderExtensions.Logger Field

-

Namespace: net.adamec.lib.common.di.postinit
-Assembly: net.adamec.lib.common
-Type: ContainerBuilderExtensions
-Sources: di\postinit\ContainerBuilderExtensions.cs
-Source-only packages: RadCommons.di.PostInit

-

Logger

-
private static readonly ILogger Logger
-

Field value

net.adamec.lib.common.logging.ILogger

-

Go to namespaces or types or source-only packages

-

ContainerBuilderExtensions.AddComponentPostInitSupport(ContainerBuilder) Method

Namespace: net.adamec.lib.common.di.postinit
Assembly: net.adamec.lib.common
@@ -1990,1039 +1609,10 @@

Exceptions

System.ArgumentNullException
type is null

Go to namespaces or types or source-only packages

-

net.adamec.lib.common.logging Namespace

-

Classes

-
NameModifierSummary
AddComponentPostInitSupport(ContainerBuilder)public staticAdds the support of PostInitAttribute to the Autofac container builder.
- - -
NameModifierSummary
CommonLogginginternal staticILogger factory
LoggerExtinternalExtended logger implementing ILogger
-

-

Interfaces

- - -
NameModifierSummary
ILoggerinternal abstractLogger interface - wrapper around the NLog.ILogger with some additional methods
-

-

Go to namespaces or types or source-only packages

-

-

CommonLogging Class

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Sources: logging\CommonLogging.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

ILogger factory

-
internal static class CommonLogging
-

Inheritance: object
-

-

Methods

- - - - -
NameModifierSummary
CreateLogger(string)public staticCreates the logger with given categoryName
CreateLogger(Type)public staticCreates the logger for given type. The name of the logger will be System.Type.FullName
CreateLogger<T>()public staticCreates the logger for given type. The name of the logger will be System.Type.FullName
-

-

Go to namespaces or types or source-only packages

-

-

CommonLogging.CreateLogger(string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: CommonLogging
-Sources: logging\CommonLogging.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Creates the logger with given categoryName

-
public static ILogger CreateLogger(string categoryName)
-Method parameters
string categoryName
Name of the logger
-

Return value

net.adamec.lib.common.logging.ILogger
Logger instance

-

Go to namespaces or types or source-only packages

-

-

CommonLogging.CreateLogger(Type) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: CommonLogging
-Sources: logging\CommonLogging.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Creates the logger for given type. The name of the logger will be System.Type.FullName

-
public static ILogger CreateLogger(Type type)
-Method parameters
System.Type type
Type to create the logger for
-

Return value

net.adamec.lib.common.logging.ILogger
Logger instance

-

Go to namespaces or types or source-only packages

-

-

CommonLogging.CreateLogger<T>() Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: CommonLogging
-Sources: logging\CommonLogging.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Creates the logger for given type. The name of the logger will be System.Type.FullName

-
public static ILogger CreateLogger<T>()
-Type parameters
T
Type to create the logger for
-

Return value

net.adamec.lib.common.logging.ILogger
Logger instance

-

Go to namespaces or types or source-only packages

-

-

LoggerExt Class

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Sources: logging\LoggerExt.CorrelationId.cs, logging\LoggerExt.cs, logging\LoggerExt.EventProperties.cs, logging\LoggerExt.ExceptionFilter.cs, logging\LoggerExt.ExceptionPassThrough.cs
-Source-only packages: RadCommons.logging.CommonLogging, RadCommons.logging.CommonLogging, RadCommons.logging.CommonLogging, RadCommons.logging.CommonLogging, RadCommons.logging.CommonLogging

-

Extended logger implementing ILogger

-
internal class LoggerExt : Logger, ILogger
-

Inheritance: object -> NLog.Logger
-Implements: net.adamec.lib.common.logging.ILogger, NLog.ILogger, NLog.ILoggerBase, NLog.ISuppress

-

Methods

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameModifierSummary
CreateException<TException>(string, string, Exception)private staticWrites the diagnostic message at the Fatal level. Creates and returns the exception of given type
Debug(Dictionary<string,object>, string)publicWrites the diagnostic message at the Debug level.
DebugCorr(string, string)publicWrites the diagnostic message at the Debug level with correlation ID.
Error(Dictionary<string,object>, Exception, string)publicWrites the diagnostic message at the Error level.
Error(Dictionary<string,object>, string)publicWrites the diagnostic message at the Error level.
Error<TException>(string, Exception)publicWrites the diagnostic message at the Error level. Creates and returns the exception of given type
ErrorCorr(string, Exception, string)publicWrites the diagnostic message at the Error level with correlation ID.
ErrorCorr(string, string)publicWrites the diagnostic message at the Error level with correlation ID.
ErrorCorr<TException>(string, LoggerExt.TException, string)publicWrites the diagnostic message at the Error level and returns the exception of given type
ErrorCorr<TException>(string, string, Exception)publicWrites the diagnostic message at the Error level with correlation ID. Creates and returns the exception of given type
ErrorFltr<TException>(LoggerExt.TException, string, bool)publicWrites the diagnostic message at the Error level and returns the exception of given type
ErrorFltrCorr<TException>(string, LoggerExt.TException, string, bool)publicWrites the diagnostic message at the Error level and returns the exception of given type
ErrorPassThrough(Exception, string)publicWrites the diagnostic message at the Error level and returns given exception
Fatal(Dictionary<string,object>, Exception, string)publicWrites the diagnostic message at the Fatal level.
Fatal(Dictionary<string,object>, string)publicWrites the diagnostic message at the Fatal level.
Fatal<TException>(string, Exception)publicWrites the diagnostic message at the Fatal level. Creates and returns the exception of given type
FatalCorr(string, Exception, string)publicWrites the diagnostic message at the Fatal level with correlation ID.
FatalCorr(string, string)publicWrites the diagnostic message at the Fatal level with correlation ID.
FatalCorr<TException>(string, LoggerExt.TException, string)publicWrites the diagnostic message at the Fatal level and returns the exception of given type
FatalCorr<TException>(string, string, Exception)publicWrites the diagnostic message at the Fatal level with correlation ID. Creates and returns the exception of given type
FatalFltr<TException>(LoggerExt.TException, string, bool)publicWrites the diagnostic message at the Fatal level and returns catchIt value.
FatalFltrCorr<TException>(string, LoggerExt.TException, string, bool)publicWrites the diagnostic message at the Fatal level and returns catchIt value.
FatalPassThrough(Exception, string)publicWrites the diagnostic message at the Fatal level and returns given exception >
Info(Dictionary<string,object>, string)publicWrites the diagnostic message at the Info level.
InfoCorr(string, string)publicWrites the diagnostic message at the Info level with correlation ID.
LogIt(LogLevel, Dictionary<string,object>, string, Exception, string)privateWrites the item (message with optional event properties and exception) into the log
LogIt(LogLevel, string, Exception, string)privateWrites the item (message with optional exception) into the log
LogIt(LogLevel, string, string, Exception, string)privateWrites the item (message with optional exception) with correlation Id into the log
Trace(Dictionary<string,object>, string)publicWrites the diagnostic message at the Trace level.
TraceCorr(string, string)publicWrites the diagnostic message at the Trace level with correlation ID
Warn(Dictionary<string,object>, Exception, string)publicWrites the diagnostic message at the Warn level.
Warn(Dictionary<string,object>, string)publicWrites the diagnostic message at the Warn level.
WarnCorr(string, Exception, string)publicWrites the diagnostic message at the Warn level with correlation ID.
WarnCorr(string, string)publicWrites the diagnostic message at the Warn level with correlation ID.
-

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.CreateException<TException>(string, string, Exception) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level. Creates and returns the exception of given type

-
private static LoggerExt.TException CreateException<TException>(string message, out string stackTrace, Exception innerException = null) where TException: Exception
-Type parameters
TException
-Method parameters
string message
Log message.
string stackTrace
Stack trace to be logged in StackTrace event property
System.Exception innerException
Exception to be logged
-

Return value

net.adamec.lib.common.logging.LoggerExt.TException
Created exception

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.Debug(Dictionary<string,object>, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Debug level.

-
public void Debug(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-

Return value

void
Implements: ILogger.Debug(Dictionary<string,object>, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.DebugCorr(string, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Debug level with correlation ID.

-
public void DebugCorr(string correlationId, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
string message
Log message.
-

Return value

void
Implements: ILogger.DebugCorr(string, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.Error(Dictionary<string,object>, Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level.

-
public void Error(Dictionary<string,object> eventProperties, Exception exception, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

void
Implements: ILogger.Error(Dictionary<string,object>, Exception, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.Error(Dictionary<string,object>, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level.

-
public void Error(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-

Return value

void
Implements: ILogger.Error(Dictionary<string,object>, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.Error<TException>(string, Exception) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.ExceptionPassThrough.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level. Creates and returns the exception of given type

-
public LoggerExt.TException Error<TException>(string message, Exception innerException = null) where TException: Exception
-Type parameters
TException
-Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
-

Return value

net.adamec.lib.common.logging.LoggerExt.TException
Created exception
Implements: ILogger.Error<TException>(string, Exception)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.ErrorCorr(string, Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level with correlation ID.

-
public void ErrorCorr(string correlationId, Exception exception, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

void
Implements: ILogger.ErrorCorr(string, Exception, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.ErrorCorr(string, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level with correlation ID.

-
public void ErrorCorr(string correlationId, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
string message
Log message.
-

Return value

void
Implements: ILogger.ErrorCorr(string, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.ErrorCorr<TException>(string, LoggerExt.TException, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level and returns the exception of given type

-
public LoggerExt.TException ErrorCorr<TException>(string correlationId, LoggerExt.TException exception, string message = null) where TException: Exception
-Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
-

Return value

net.adamec.lib.common.logging.LoggerExt.TException
Pass-through exception
Implements: ILogger.ErrorCorr<TException>(string, ILogger.TException, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.ErrorCorr<TException>(string, string, Exception) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level with correlation ID. Creates and returns the exception of given type

-
public LoggerExt.TException ErrorCorr<TException>(string correlationId, string message, Exception innerException = null) where TException: Exception
-Type parameters
TException
-Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
-

Return value

net.adamec.lib.common.logging.LoggerExt.TException
Created exception
Implements: ILogger.ErrorCorr<TException>(string, string, Exception)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.ErrorFltr<TException>(LoggerExt.TException, string, bool) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.ExceptionFilter.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level and returns the exception of given type

-
public bool ErrorFltr<TException>(LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception
-Type parameters
TException
-Method parameters
net.adamec.lib.common.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-

Return value

bool
Flag whether the exception is to be catch by exception filter
Implements: ILogger.ErrorFltr<TException>(ILogger.TException, string, bool)

-

Example

-

The following code logs any exception without catching it (function returns false by default)

    try
-    {
-      ...
-    }
-    catch (Exception e) when (Logger.FatalFltr(e)) {}
The following code catch and log the ArgumentException and logs any other exception without catching it.
    try
-    {
-      ...
-    }
-    catch (ArgumentException e) when (Logger.ErrorFltr(e,catchIt:true)) {}
-    catch (Exception e) when (Logger.FatalFltr(e)) {}

-

Remarks

-

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.ErrorFltrCorr<TException>(string, LoggerExt.TException, string, bool) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level and returns the exception of given type

-
public bool ErrorFltrCorr<TException>(string correlationId, LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception
-Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-

Return value

bool
Flag whether the exception is to be catch by exception filter
Implements: ILogger.ErrorFltrCorr<TException>(string, ILogger.TException, string, bool)

-

Remarks

-

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

-

See Also

-

ErrorFltr<TException>(LoggerExt.TException, string, bool)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.ErrorPassThrough(Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.ExceptionPassThrough.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level and returns given exception

-
public Exception ErrorPassThrough(Exception exception, string message = null)
-Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

System.Exception
Pass-through exception
Implements: ILogger.ErrorPassThrough(Exception, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.Fatal(Dictionary<string,object>, Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level.

-
public void Fatal(Dictionary<string,object> eventProperties, Exception exception, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

void
Implements: ILogger.Fatal(Dictionary<string,object>, Exception, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.Fatal(Dictionary<string,object>, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level.

-
public void Fatal(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-

Return value

void
Implements: ILogger.Fatal(Dictionary<string,object>, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.Fatal<TException>(string, Exception) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.ExceptionPassThrough.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level. Creates and returns the exception of given type

-
public LoggerExt.TException Fatal<TException>(string message, Exception innerException = null) where TException: Exception
-Type parameters
TException
-Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
-

Return value

net.adamec.lib.common.logging.LoggerExt.TException
Created exception
Implements: ILogger.Fatal<TException>(string, Exception)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.FatalCorr(string, Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level with correlation ID.

-
public void FatalCorr(string correlationId, Exception exception, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

void
Implements: ILogger.FatalCorr(string, Exception, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.FatalCorr(string, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level with correlation ID.

-
public void FatalCorr(string correlationId, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
string message
Log message.
-

Return value

void
Implements: ILogger.FatalCorr(string, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.FatalCorr<TException>(string, LoggerExt.TException, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level and returns the exception of given type

-
public LoggerExt.TException FatalCorr<TException>(string correlationId, LoggerExt.TException exception, string message = null) where TException: Exception
-Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
-

Return value

net.adamec.lib.common.logging.LoggerExt.TException
Pass-through exception
Implements: ILogger.FatalCorr<TException>(string, ILogger.TException, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.FatalCorr<TException>(string, string, Exception) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level with correlation ID. Creates and returns the exception of given type

-
public LoggerExt.TException FatalCorr<TException>(string correlationId, string message, Exception innerException = null) where TException: Exception
-Type parameters
TException
-Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
-

Return value

net.adamec.lib.common.logging.LoggerExt.TException
Created exception
Implements: ILogger.FatalCorr<TException>(string, string, Exception)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.FatalFltr<TException>(LoggerExt.TException, string, bool) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.ExceptionFilter.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level and returns catchIt value.

-
public bool FatalFltr<TException>(LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception
-Type parameters
TException
-Method parameters
net.adamec.lib.common.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-

Return value

bool
Flag whether the exception is to be catch by exception filter
Implements: ILogger.FatalFltr<TException>(ILogger.TException, string, bool)

-

Remarks

-

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

-

See Also

-

ErrorFltr<TException>(LoggerExt.TException, string, bool)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.FatalFltrCorr<TException>(string, LoggerExt.TException, string, bool) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level and returns catchIt value.

-
public bool FatalFltrCorr<TException>(string correlationId, LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception
-Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-

Return value

bool
Flag whether the exception is to be catch by exception filter
Implements: ILogger.FatalFltrCorr<TException>(string, ILogger.TException, string, bool)

-

Remarks

-

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

-

See Also

-

ErrorFltr<TException>(LoggerExt.TException, string, bool)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.FatalPassThrough(Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.ExceptionPassThrough.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level and returns given exception >

-
public Exception FatalPassThrough(Exception exception, string message = null)
-Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

System.Exception
Pass-through exception
Implements: ILogger.FatalPassThrough(Exception, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.Info(Dictionary<string,object>, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Info level.

-
public void Info(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-

Return value

void
Implements: ILogger.Info(Dictionary<string,object>, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.InfoCorr(string, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Info level with correlation ID.

-
public void InfoCorr(string correlationId, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
string message
Log message.
-

Return value

void
Implements: ILogger.InfoCorr(string, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.LogIt(LogLevel, Dictionary<string,object>, string, Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the item (message with optional event properties and exception) into the log

-
private void LogIt(LogLevel level, Dictionary<string,object> eventProperties, [Localizable(false)] string message, Exception exception = null, string stackTrace = null)
-Method parameters
NLog.LogLevel level
Dictionary<string,object> eventProperties
Event properties (null when no properties are provided)
string message
Log message
System.Exception exception
Optional exception to be logged
string stackTrace
Optional stack trace to be logged in StackTrace event property when the System.Exception.StackTrace of exception is empty
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.LogIt(LogLevel, string, Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the item (message with optional exception) into the log

-
private void LogIt(LogLevel level, [Localizable(false)] string message, Exception exception = null, string stackTrace = null)
-Method parameters
NLog.LogLevel level
string message
Log message
System.Exception exception
Optional exception to be logged
string stackTrace
Optional stack trace to be logged in StackTrace event property when the System.Exception.StackTrace of exception is empty
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.LogIt(LogLevel, string, string, Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the item (message with optional exception) with correlation Id into the log

-
private void LogIt(LogLevel level, string correlationId, [Localizable(false)] string message, Exception exception = null, string stackTrace = null)
-Method parameters
NLog.LogLevel level
string correlationId
Correlation ID
string message
Log message
System.Exception exception
Optional exception to be logged
string stackTrace
Optional stack trace to be logged in StackTrace event property when the System.Exception.StackTrace of exception is empty
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.Trace(Dictionary<string,object>, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Trace level.

-
public void Trace(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-

Return value

void
Implements: ILogger.Trace(Dictionary<string,object>, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.TraceCorr(string, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Trace level with correlation ID

-
public void TraceCorr(string correlationId, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
string message
Log message.
-

Return value

void
Implements: ILogger.TraceCorr(string, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.Warn(Dictionary<string,object>, Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Warn level.

-
public void Warn(Dictionary<string,object> eventProperties, Exception exception, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

void
Implements: ILogger.Warn(Dictionary<string,object>, Exception, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.Warn(Dictionary<string,object>, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Warn level.

-
public void Warn(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-

Return value

void
Implements: ILogger.Warn(Dictionary<string,object>, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.WarnCorr(string, Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Warn level with correlation ID.

-
public void WarnCorr(string correlationId, Exception exception, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

void
Implements: ILogger.WarnCorr(string, Exception, string)

-

Go to namespaces or types or source-only packages

-

-

LoggerExt.WarnCorr(string, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: LoggerExt
-Sources: logging\LoggerExt.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Warn level with correlation ID.

-
public void WarnCorr(string correlationId, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
string message
Log message.
-

Return value

void
Implements: ILogger.WarnCorr(string, string)

-

Go to namespaces or types or source-only packages

-

-

ILogger Interface

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Sources: logging\ILogger.CorrelationId.cs, logging\ILogger.cs, logging\ILogger.EventProperties.cs, logging\ILogger.ExceptionFilter.cs, logging\ILogger.ExceptionPassThrough.cs
-Source-only packages: RadCommons.logging.CommonLogging, RadCommons.logging.CommonLogging, RadCommons.logging.CommonLogging, RadCommons.logging.CommonLogging, RadCommons.logging.CommonLogging

-

Logger interface - wrapper around the NLog.ILogger with some additional methods

-
internal interface ILogger : ILogger
-

Implemented by: net.adamec.lib.common.logging.LoggerExt
-Implements: NLog.ILogger, NLog.ILoggerBase, NLog.ISuppress

-

Remarks

-

The NLog supports having additional (custom) event properties provided to loggers and optionally rendered to logs. The event properties are represented as key-value dictionary, where key is the unique name of the property.

Extended logger provides following methods to log with given set of the properties.

- - - -

Sometimes, it's useful to have an exception logging method implemented as the operation returning the exception being logged. The ErrorPassThrough(Exception, string) and FatalPassThrough(Exception, string) methods will log given exception and return it for further processing.

    try
-    {
-      ...
-    }
-    catch (Exception ex){
-       if(logger.ErrorPassThrough(ex) is MyException){
-         return null;
-       }else{
-         throw;
-       } 
-    }
In the example above, the exception is always logged and then the decision/action is taken.

C# 6 brought the exception filters that don't unwind the stack as the exception is not catch yet when processing the filter. It can also be used for logging the exceptions without actually catching them (when the exception filter returns false ). Extended logger provides functions ErrorFltr<TException>(ILogger.TException, string, bool) and FatalFltr<TException>(ILogger.TException, string, bool) for this purpose.

    try
-    {
-      ...
-    }
-    catch (Exception ex) when (logger.ErrorFltr(ex,"Error here!"){
-      //newer called as the default return value of ErrorFltr is false     
-    }
The example above logs but never catch all exceptions. The following code catch and log the ArgumentException and logs any other exception without catching it.
    try
-    {
-      ...
-    }
-    catch (ArgumentException e) when (Logger.ErrorFltr(e,catchIt:true)) { ... }
-    catch (Exception e) when (Logger.FatalFltr(e)) {}

Logger can also create and exception, log it and return using functions Error<TException>(string, Exception) and Fatal<TException>(string, Exception)

    if(value is null) throw logger.Fatal<ArgumentNullException>("Value is null");

When logging an exception using the LoggerExt methods, the event property StackTrace is set from System.Exception.StackTrace , when the logger creates an exception, the property is set using new StackTrace(2, true).ToString() . In other cases when the System.Exception.StackTrace is null or empty, new StackTrace(true).ToString() is used.

LoggerExt also provides set of methods for logging with the correlation ID (for example in integration scenarios), where the given correlation ID is set to the event property CorrelationId . Such methods have the name ending with Corr suffix.

-

Methods

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameModifierSummary
Debug(Dictionary<string,object>, string)public abstractWrites the diagnostic message at the Debug level.
DebugCorr(string, string)public abstractWrites the diagnostic message at the Debug level with correlation ID.
Error(Dictionary<string,object>, Exception, string)public abstractWrites the diagnostic message at the Error level.
Error(Dictionary<string,object>, string)public abstractWrites the diagnostic message at the Error level.
Error<TException>(string, Exception)public abstractWrites the diagnostic message at the Error level. Creates and returns the exception of given type
ErrorCorr(string, Exception, string)public abstractWrites the diagnostic message at the Error level with correlation ID.
ErrorCorr(string, string)public abstractWrites the diagnostic message at the Error level with correlation ID.
ErrorCorr<TException>(string, ILogger.TException, string)public abstractWrites the diagnostic message at the Error level and returns the exception of given type
ErrorCorr<TException>(string, string, Exception)public abstractWrites the diagnostic message at the Error level with correlation ID. Creates and returns the exception of given type
ErrorFltr<TException>(ILogger.TException, string, bool)public abstractWrites the diagnostic message at the Error level and returns the exception of given type
ErrorFltrCorr<TException>(string, ILogger.TException, string, bool)public abstractWrites the diagnostic message at the Error level and returns the exception of given type
ErrorPassThrough(Exception, string)public abstractWrites the diagnostic message at the Error level and returns given exception
Fatal(Dictionary<string,object>, Exception, string)public abstractWrites the diagnostic message at the Fatal level.
Fatal(Dictionary<string,object>, string)public abstractWrites the diagnostic message at the Fatal level.
Fatal<TException>(string, Exception)public abstractWrites the diagnostic message at the Fatal level. Creates and returns the exception of given type
FatalCorr(string, Exception, string)public abstractWrites the diagnostic message at the Fatal level with correlation ID.
FatalCorr(string, string)public abstractWrites the diagnostic message at the Fatal level with correlation ID.
FatalCorr<TException>(string, ILogger.TException, string)public abstractWrites the diagnostic message at the Fatal level and returns the exception of given type
FatalCorr<TException>(string, string, Exception)public abstractWrites the diagnostic message at the Fatal level with correlation ID. Creates and returns the exception of given type
FatalFltr<TException>(ILogger.TException, string, bool)public abstractWrites the diagnostic message at the Fatal level and returns catchIt value.
FatalFltrCorr<TException>(string, ILogger.TException, string, bool)public abstractWrites the diagnostic message at the Fatal level and returns catchIt value.
FatalPassThrough(Exception, string)public abstractWrites the diagnostic message at the Fatal level and returns given exception
Info(Dictionary<string,object>, string)public abstractWrites the diagnostic message at the Info level.
InfoCorr(string, string)public abstractWrites the diagnostic message at the Info level with correlation ID.
Trace(Dictionary<string,object>, string)public abstractWrites the diagnostic message at the Trace level.
TraceCorr(string, string)public abstractWrites the diagnostic message at the Trace level with correlation ID.
Warn(Dictionary<string,object>, Exception, string)public abstractWrites the diagnostic message at the Warn level.
Warn(Dictionary<string,object>, string)public abstractWrites the diagnostic message at the Warn level.
WarnCorr(string, Exception, string)public abstractWrites the diagnostic message at the Warn level with correlation ID.
WarnCorr(string, string)public abstractWrites the diagnostic message at the Warn level with correlation ID.
-

-

Go to namespaces or types or source-only packages

-

-

ILogger.Debug(Dictionary<string,object>, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Debug level.

-
public abstract void Debug(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.DebugCorr(string, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Debug level with correlation ID.

-
public abstract void DebugCorr(string correlationId, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.Error(Dictionary<string,object>, Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level.

-
public abstract void Error(Dictionary<string,object> eventProperties, Exception exception, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.Error(Dictionary<string,object>, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level.

-
public abstract void Error(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.Error<TException>(string, Exception) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.ExceptionPassThrough.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level. Creates and returns the exception of given type

-
public abstract ILogger.TException Error<TException>(string message, Exception innerException = null) where TException: Exception
-Type parameters
TException
-Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
-

Return value

net.adamec.lib.common.logging.ILogger.TException
Created exception

-

Go to namespaces or types or source-only packages

-

-

ILogger.ErrorCorr(string, Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level with correlation ID.

-
public abstract void ErrorCorr(string correlationId, Exception exception, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.ErrorCorr(string, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level with correlation ID.

-
public abstract void ErrorCorr(string correlationId, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.ErrorCorr<TException>(string, ILogger.TException, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level and returns the exception of given type

-
public abstract ILogger.TException ErrorCorr<TException>(string correlationId, ILogger.TException exception, string message = null) where TException: Exception
-Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
-

Return value

net.adamec.lib.common.logging.ILogger.TException
Pass-through exception

-

Go to namespaces or types or source-only packages

-

-

ILogger.ErrorCorr<TException>(string, string, Exception) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level with correlation ID. Creates and returns the exception of given type

-
public abstract ILogger.TException ErrorCorr<TException>(string correlationId, string message, Exception innerException = null) where TException: Exception
-Type parameters
TException
-Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
-

Return value

net.adamec.lib.common.logging.ILogger.TException
Created exception

-

Go to namespaces or types or source-only packages

-

-

ILogger.ErrorFltr<TException>(ILogger.TException, string, bool) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.ExceptionFilter.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level and returns the exception of given type

-
public abstract bool ErrorFltr<TException>(ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception
-Type parameters
TException
-Method parameters
net.adamec.lib.common.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-

Return value

bool
Flag whether the exception is to be catch by exception filter

-

Example

-

The following code logs any exception without catching it (function returns false by default)

    try
-    {
-      ...
-    }
-    catch (Exception e) when (Logger.FatalFltr(e)) {}
The following code catch and log the ArgumentException and logs any other exception without catching it.
    try
-    {
-      ...
-    }
-    catch (ArgumentException e) when (Logger.ErrorFltr(e,catchIt:true)) {}
-    catch (Exception e) when (Logger.FatalFltr(e)) {}

-

Remarks

-

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

-

Go to namespaces or types or source-only packages

-

-

ILogger.ErrorFltrCorr<TException>(string, ILogger.TException, string, bool) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level and returns the exception of given type

-
public abstract bool ErrorFltrCorr<TException>(string correlationId, ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception
-Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-

Return value

bool
Flag whether the exception is to be catch by exception filter

-

Remarks

-

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

-

See Also

-

ErrorFltr<TException>(ILogger.TException, string, bool)

-

Go to namespaces or types or source-only packages

-

-

ILogger.ErrorPassThrough(Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.ExceptionPassThrough.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Error level and returns given exception

-
public abstract Exception ErrorPassThrough(Exception exception, string message = null)
-Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

System.Exception
Pass-through exception

-

Go to namespaces or types or source-only packages

-

-

ILogger.Fatal(Dictionary<string,object>, Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level.

-
public abstract void Fatal(Dictionary<string,object> eventProperties, Exception exception, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.Fatal(Dictionary<string,object>, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level.

-
public abstract void Fatal(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.Fatal<TException>(string, Exception) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.ExceptionPassThrough.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level. Creates and returns the exception of given type

-
public abstract ILogger.TException Fatal<TException>(string message, Exception innerException = null) where TException: Exception
-Type parameters
TException
-Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
-

Return value

net.adamec.lib.common.logging.ILogger.TException
Created exception

-

Go to namespaces or types or source-only packages

-

-

ILogger.FatalCorr(string, Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level with correlation ID.

-
public abstract void FatalCorr(string correlationId, Exception exception, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.FatalCorr(string, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level with correlation ID.

-
public abstract void FatalCorr(string correlationId, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.FatalCorr<TException>(string, ILogger.TException, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level and returns the exception of given type

-
public abstract ILogger.TException FatalCorr<TException>(string correlationId, ILogger.TException exception, string message = null) where TException: Exception
-Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
-

Return value

net.adamec.lib.common.logging.ILogger.TException
Pass-through exception

-

Go to namespaces or types or source-only packages

-

-

ILogger.FatalCorr<TException>(string, string, Exception) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level with correlation ID. Creates and returns the exception of given type

-
public abstract ILogger.TException FatalCorr<TException>(string correlationId, string message, Exception innerException = null) where TException: Exception
-Type parameters
TException
-Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
-

Return value

net.adamec.lib.common.logging.ILogger.TException
Created exception

-

Go to namespaces or types or source-only packages

-

-

ILogger.FatalFltr<TException>(ILogger.TException, string, bool) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.ExceptionFilter.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level and returns catchIt value.

-
public abstract bool FatalFltr<TException>(ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception
-Type parameters
TException
-Method parameters
net.adamec.lib.common.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-

Return value

bool
Flag whether the exception is to be catch by exception filter

-

Remarks

-

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

-

See Also

-

ErrorFltr<TException>(ILogger.TException, string, bool)

-

Go to namespaces or types or source-only packages

-

-

ILogger.FatalFltrCorr<TException>(string, ILogger.TException, string, bool) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level and returns catchIt value.

-
public abstract bool FatalFltrCorr<TException>(string correlationId, ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception
-Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-

Return value

bool
Flag whether the exception is to be catch by exception filter

-

Remarks

-

This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created)

-

See Also

-

ErrorFltr<TException>(ILogger.TException, string, bool)

-

Go to namespaces or types or source-only packages

-

-

ILogger.FatalPassThrough(Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.ExceptionPassThrough.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Fatal level and returns given exception

-
public abstract Exception FatalPassThrough(Exception exception, string message = null)
-Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

System.Exception
Pass-through exception

-

Go to namespaces or types or source-only packages

-

-

ILogger.Info(Dictionary<string,object>, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Info level.

-
public abstract void Info(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.InfoCorr(string, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Info level with correlation ID.

-
public abstract void InfoCorr(string correlationId, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.Trace(Dictionary<string,object>, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Trace level.

-
public abstract void Trace(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.TraceCorr(string, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Trace level with correlation ID.

-
public abstract void TraceCorr(string correlationId, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.Warn(Dictionary<string,object>, Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Warn level.

-
public abstract void Warn(Dictionary<string,object> eventProperties, Exception exception, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.Warn(Dictionary<string,object>, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.EventProperties.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Warn level.

-
public abstract void Warn(Dictionary<string,object> eventProperties, [Localizable(false)] string message)
-Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.WarnCorr(string, Exception, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Warn level with correlation ID.

-
public abstract void WarnCorr(string correlationId, Exception exception, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

ILogger.WarnCorr(string, string) Method

-

Namespace: net.adamec.lib.common.logging
-Assembly: net.adamec.lib.common
-Type: ILogger
-Sources: logging\ILogger.CorrelationId.cs
-Source-only packages: RadCommons.logging.CommonLogging

-

Writes the diagnostic message at the Warn level with correlation ID.

-
public abstract void WarnCorr(string correlationId, [Localizable(false)] string message)
-Method parameters
string correlationId
Correlation ID
string message
Log message.
-

Return value

void

-

Go to namespaces or types or source-only packages

-

net.adamec.lib.common.utils Namespace

Classes

- @@ -3157,172 +1747,6 @@

void
Overrides: ComponentModel.BackgroundWorker.OnDoWork

Go to namespaces or types or source-only packages

-

BaseDisposable Class

-

Namespace: net.adamec.lib.common.utils
-Assembly: net.adamec.lib.common
-Sources: utils\BaseDisposable.cs
-Source-only packages: RadCommons.utils.BaseDisposable

-

Helper class for implementation of System.IDisposable types

-
public abstract class BaseDisposable : IDisposable
-

Inheritance: object
-Derived: net.adamec.lib.common.utils.Context<TState>, net.adamec.lib.common.utils.Disposer, net.adamec.lib.common.utils.Scope<TState>
-Implements: IDisposable

-

Constants

-
NameModifierSummary
BackgroundWorkerWithSyncCancelpublicExecutes an operation on a separate thread with possibility of sync cancel.
BaseDisposablepublic abstractHelper class for implementation of System.IDisposable types
ConsoleUtilsinternal staticConsole output helpers
Context<TState>internalBase context implementation.
DisposerinternalKeeps the stack of disposable objects, and disposes them when the disposer is being disposed.
- -
NameValueSummary
DisposedFlag1Internal flag whether the object is fully disposed
-

-

Fields

- - -
NameModifierSummary
isDisposedprivateThe object is disposed when equals to DisposedFlag
-

-

Properties

- - - - -
NameModifierSummary
DisposedpublicReturns
true
when the object is fully disposed
DisposedManagedpublicReturns
true
when the managed resources are disposed
DisposedNativepublicReturns
true
when the native resources are disposed
-

-

Destructor

- - -
NameModifierSummary
~BaseDisposable()protected
-

-

Methods

- - - - - - -
NameModifierSummary
AssertNotDisposed(string)protectedThrows an System.ObjectDisposedException when the current object is disposed
Dispose()publicDispose the object
Dispose(bool)protectedInternal implementation of dispose - free the managed and native resources using the respective methods
DisposeManaged()protectedDispose any disposable managed fields or properties.
DisposeNative()protectedDispose of COM objects, Handles, etc. Then set those objects to null.
-

-

Go to namespaces or types or source-only packages

-

-

BaseDisposable.DisposedFlag Constant

-

Namespace: net.adamec.lib.common.utils
-Assembly: net.adamec.lib.common
-Type: BaseDisposable
-Sources: utils\BaseDisposable.cs
-Source-only packages: RadCommons.utils.BaseDisposable

-

Internal flag whether the object is fully disposed

-
private const int DisposedFlag = 1
-

Field value

int

-

Go to namespaces or types or source-only packages

-

-

BaseDisposable.isDisposed Field

-

Namespace: net.adamec.lib.common.utils
-Assembly: net.adamec.lib.common
-Type: BaseDisposable
-Sources: utils\BaseDisposable.cs
-Source-only packages: RadCommons.utils.BaseDisposable

-

The object is disposed when equals to DisposedFlag

-
private int isDisposed
-

Field value

int

-

Go to namespaces or types or source-only packages

-

-

BaseDisposable.Disposed Property

-

Namespace: net.adamec.lib.common.utils
-Assembly: net.adamec.lib.common
-Type: BaseDisposable
-Sources: utils\BaseDisposable.cs
-Source-only packages: RadCommons.utils.BaseDisposable

-

Returns

true
when the object is fully disposed

-
public bool Disposed { get; }
-

Property value

bool

-

Go to namespaces or types or source-only packages

-

-

BaseDisposable.DisposedManaged Property

-

Namespace: net.adamec.lib.common.utils
-Assembly: net.adamec.lib.common
-Type: BaseDisposable
-Sources: utils\BaseDisposable.cs
-Source-only packages: RadCommons.utils.BaseDisposable

-

Returns

true
when the managed resources are disposed

-
public bool DisposedManaged { get; private set; }
-

Property value

bool

-

Go to namespaces or types or source-only packages

-

-

BaseDisposable.DisposedNative Property

-

Namespace: net.adamec.lib.common.utils
-Assembly: net.adamec.lib.common
-Type: BaseDisposable
-Sources: utils\BaseDisposable.cs
-Source-only packages: RadCommons.utils.BaseDisposable

-

Returns

true
when the native resources are disposed

-
public bool DisposedNative { get; private set; }
-

Property value

bool

-

Go to namespaces or types or source-only packages

-

-

BaseDisposable.~BaseDisposable() Destructor

-

Namespace: net.adamec.lib.common.utils
-Assembly: net.adamec.lib.common
-Type: BaseDisposable
-Sources: utils\BaseDisposable.cs
-Source-only packages: RadCommons.utils.BaseDisposable

-
 ~BaseDisposable()
-

Go to namespaces or types or source-only packages

-

-

BaseDisposable.AssertNotDisposed(string) Method

-

Namespace: net.adamec.lib.common.utils
-Assembly: net.adamec.lib.common
-Type: BaseDisposable
-Sources: utils\BaseDisposable.cs
-Source-only packages: RadCommons.utils.BaseDisposable

-

Throws an System.ObjectDisposedException when the current object is disposed

-
protected void AssertNotDisposed(string message = null)
-Method parameters
string message
Optional exception message
-

Return value

void

-

Exceptions

-

System.ObjectDisposedException
Current object is disposed

-

Go to namespaces or types or source-only packages

-

-

BaseDisposable.Dispose() Method

-

Namespace: net.adamec.lib.common.utils
-Assembly: net.adamec.lib.common
-Type: BaseDisposable
-Sources: utils\BaseDisposable.cs
-Source-only packages: RadCommons.utils.BaseDisposable

-

Dispose the object

-
public void Dispose()
-

Return value

void
Implements: IDisposable.Dispose

-

Go to namespaces or types or source-only packages

-

-

BaseDisposable.Dispose(bool) Method

-

Namespace: net.adamec.lib.common.utils
-Assembly: net.adamec.lib.common
-Type: BaseDisposable
-Sources: utils\BaseDisposable.cs
-Source-only packages: RadCommons.utils.BaseDisposable

-

Internal implementation of dispose - free the managed and native resources using the respective methods

-
protected virtual void Dispose(bool disposing)
-Method parameters
bool disposing
True to dispose both managed and native resources, false to dispose the native resources only
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

BaseDisposable.DisposeManaged() Method

-

Namespace: net.adamec.lib.common.utils
-Assembly: net.adamec.lib.common
-Type: BaseDisposable
-Sources: utils\BaseDisposable.cs
-Source-only packages: RadCommons.utils.BaseDisposable

-

Dispose any disposable managed fields or properties.

-
protected virtual void DisposeManaged()
-

Return value

void

-

Go to namespaces or types or source-only packages

-

-

BaseDisposable.DisposeNative() Method

-

Namespace: net.adamec.lib.common.utils
-Assembly: net.adamec.lib.common
-Type: BaseDisposable
-Sources: utils\BaseDisposable.cs
-Source-only packages: RadCommons.utils.BaseDisposable

-

Dispose of COM objects, Handles, etc. Then set those objects to null.

-
protected virtual void DisposeNative()
-

Return value

void

-

Go to namespaces or types or source-only packages

-

ConsoleUtils Class

Namespace: net.adamec.lib.common.utils
Assembly: net.adamec.lib.common
@@ -3452,7 +1876,7 @@

Context<

Base context implementation.

internal class Context<TState> : BaseDisposable where TState: class, new()
Type parameters
TState
Type of the state object managed by the context
-

Inheritance: object -> net.adamec.lib.common.utils.BaseDisposable
+

Inheritance: object -> net.adamec.lib.common.core.utils.BaseDisposable
Implements: IDisposable

Remarks

The context can be both state-less and state-full and it's valid until it's disposed. The current context is accessible via Current . The contexts are chained, when a new context is created using BeginContext(Context<TState>.TState) , the Current context became the Parent of the new one and the newly created context will be set as the Current one. When the context is disposed, the Current context is set to Parent of disposing context. Context's children are disposed as well during the context disposal. The AddToDisposer(IDisposable) method is to be used in inherited classes whenever they manage any disposable resource to ensure their proper life time (when the State is System.IDisposable , it's added to disposer automatically).

The base implementation just manages the life time, context chain and keeps the state (when provided). Inherit from the Context<TState> to add the context related operations (inherited classes have the access to State ).

Based on the implementation of Guard Scopes by https://github.com/safakgur at https://github.com/safakgur/guard/blob/v1.7.0/src/Guard.Scopes.cs

@@ -3627,7 +2051,7 @@

< Source-only packages: RadCommons.utils.Context

Dispose any disposable managed objects - all disposables kept in Disposer stack are pop and disposed.

The Parent context of the disposing one will become the new Current context.

protected override void DisposeManaged()
-

Return value

void
Overrides: BaseDisposable.DisposeManaged()

+

Return value

void
Overrides: utils.BaseDisposable.DisposeManaged

Go to namespaces or types or source-only packages

Disposer Class

@@ -3637,7 +2061,7 @@

Disposer Cl Source-only packages: RadCommons.utils.Disposer

Keeps the stack of disposable objects, and disposes them when the disposer is being disposed.

internal class Disposer : BaseDisposable
-

Inheritance: object -> net.adamec.lib.common.utils.BaseDisposable
+

Inheritance: object -> net.adamec.lib.common.core.utils.BaseDisposable
Implements: IDisposable

Fields

@@ -3698,7 +2122,7 @@

protected override void Dispose(bool disposing) Method parameters
bool disposing
True to dispose both managed and native resources, false to dispose the native resources only.
-

Return value

void
Overrides: BaseDisposable.Dispose(bool)

+

Return value

void
Overrides: utils.BaseDisposable.Dispose

Remarks

When disposing the managed objects ( disposing is true), all disposables kept in disposables stack are pop and disposed.

Go to namespaces or types or source-only packages

@@ -4335,7 +2759,7 @@

Scope<TSta

Base scope implementation.

internal class Scope<TState> : BaseDisposable, IScope<TState> where TState: class, new()
Type parameters
TState
Type of the state object managed by the scope
-

Inheritance: object -> net.adamec.lib.common.utils.BaseDisposable
+

Inheritance: object -> net.adamec.lib.common.core.utils.BaseDisposable
Implements: net.adamec.lib.common.utils.IScope<TState>, IDisposable

Remarks

The scope can be both state-less and state-full and it's valid until it's disposed. The scopes can be nested, when the scope is disposed, the children are disposed as well. There can be multiple child scopes (siblings) living in parallel. The AddToDisposer(IDisposable) method is to be used in inherited classes whenever they manage any disposable resource to ensure the proper life time (when the State is System.IDisposable , it's added to disposer automatically).

The base implementation just manages the life time, child scopes and keeps the state (when provided). Inherit from the Scope<TState> (and IScope<TState> ) to add the scope related operations (inherited classes have the access to State ).

@@ -4539,7 +2963,7 @@

RadCommons.utils.Scope

Dispose any disposable managed objects - all disposables kept in Disposer stack are pop and disposed.

protected override void DisposeManaged()
-

Return value

void
Overrides: BaseDisposable.DisposeManaged()

+

Return value

void
Overrides: utils.BaseDisposable.DisposeManaged

Go to namespaces or types or source-only packages

Txt Class

@@ -4840,8 +3264,7 @@

RadCommons. Includes: None
Declaring file: async\AsyncManager.cs

Helpers for running the async tasks in sync mode and executing sync actions in async mode (Source only package).

-

Usings

RadCommons.logging.CommonLogging

-

Package members

AsyncManager (Type)
Helpers for running the actions in sync or async mode
Logger (Field)
Logger
DefaultExceptionHandler (Field)
Default exception handler for RunAsync(Action, Action<System.Exception>) . Catches and logs all exceptions during the task execution.
RunAsync(Action, Action<System.Exception>) (Method)
Runs the given action asynchronously.
RunSync(Func<System.Threading.Tasks.Task>) (Method)
Executes synchronously an async System.Threading.Tasks.Task method which has a void return value
RunSync<T>(Func<System.Threading.Tasks.Task<T>>) (Method)
Executes synchronously an async System.Threading.Tasks.Task`1 method which has a T return type
AsyncManager.ExclusiveSynchronizationContext (Type)
"Private" synchronization context used to run the async method
done (Field)
InnerException (Property)
workItemsWaiting (Field)
items (Field)
Send(SendOrPostCallback, object) (Method)
Dispatches a synchronous message to a synchronization context. Always throws System.NotSupportedException as it's not supported in AsyncManager.ExclusiveSynchronizationContext
Post(SendOrPostCallback, object) (Method)
Dispatches an asynchronous message to a synchronization context.
EndMessageLoop() (Method)
Finish the message loop
BeginMessageLoop() (Method)
Starts the message loop
CreateCopy() (Method)
Creates a "copy" of the synchronization context.

+

Package members

AsyncManager (Type)
Helpers for running the actions in sync or async mode
DefaultExceptionHandler (Field)
Default exception handler for RunAsync(Action, Action<System.Exception>) . Catches all exceptions during the task execution.
RunAsync(Action, Action<System.Exception>) (Method)
Runs the given action asynchronously.
RunSync(Func<System.Threading.Tasks.Task>) (Method)
Executes synchronously an async System.Threading.Tasks.Task method which has a void return value
RunSync<T>(Func<System.Threading.Tasks.Task<T>>) (Method)
Executes synchronously an async System.Threading.Tasks.Task`1 method which has a T return type
AsyncManager.ExclusiveSynchronizationContext (Type)
"Private" synchronization context used to run the async method
done (Field)
InnerException (Property)
workItemsWaiting (Field)
items (Field)
Send(SendOrPostCallback, object) (Method)
Dispatches a synchronous message to a synchronization context. Always throws System.NotSupportedException as it's not supported in AsyncManager.ExclusiveSynchronizationContext
Post(SendOrPostCallback, object) (Method)
Dispatches an asynchronous message to a synchronization context.
EndMessageLoop() (Method)
Finish the message loop
BeginMessageLoop() (Method)
Starts the message loop
CreateCopy() (Method)
Creates a "copy" of the synchronization context.

Sources

async\AsyncManager.cs

Go to namespaces or types or source-only packages

@@ -4854,25 +3277,11 @@

RadCommons.asy

Sources

async\FileAsync.cs

Go to namespaces or types or source-only packages

-

RadCommons.config.Configuration Source only package

-

Tags: RadCommons source-only configuration
-Includes: None
-Declaring file: config\Configuration.cs

-

Simple configuration container in case DI with more sophisticated containers is not used. Supports the JSON config files, command line arguments - and environment variables as sources and their hierarchy/overrides. The configuration can be used as key-value pairs or bound to objects (Source only package).

-

Usings

RadCommons.logging.CommonLogging

-

Remarks

-

This is the simple configuration container in case DI with more sophisticated containers is not used The configuration is stored as the key-value dictionary, supporting hierarchy using the dot separator and arrays.The arrays can contain values or another objects. Actually, mixed arrays of values and objects can be stored, but they are not supported for binding.

For example section1.option1 means the option1 available in section1, section1.subSection2.option1 means the option1 available in section1.subSection2. section1.option1[0] means, that the option1 is array of values or objects (sections) within the section1. For arrays, the keys are like OtherSection.SimpleArray[0] or OtherSection.ComplexObjectArray[0].Name

Configuration class provides a singleton instance, however the key functionality is provided via static functions, so no need to touch the Instance at all. The items can be retrieved by key using the Get(string) and Get<TValueType>(string, Configuration.TValueType) methods. The first one returns null when the key is not found, the other one allow to define the default value to be returned, when the item is not found.

The inner class Configuration.ConfigurationBuilder provides the methods to build the configuration from JSON config files, commandline arguments, environment values and/or direct entries. The static method Builder() clears the configuration items and binding cache and creates a new instance of Configuration.ConfigurationBuilder allowing to build a configuration from scratch. The configuration is updated directly during the calls to builder methods, the existing items (keys) are updated, so it's possible to manage the priority of individual sources and the overrides if needed. The method Build() returns the configuration instance, breaking the fluent design of builder methods, however there is no other functionality within the method, so it's more the convention than need to use it at the end of configuration build.

Configuration binding it the way, how to access the configuration using the configuration objects instead of querying the individual items by key. When the method Bind<TOptionsContainer>(string, bool) is used, it creates a new instance of given type and tries to map the public properties with public setter to the keys (using the "dot notation") within the Configuration . It's possible to bind the object to to the root of the configuration to provide the whole configuration at once or bind it to the particular section to provide a configuration sub-tree. In general, the nested objects and both value and object arrays are supported. There are some rules when binding the arrays: The index must start with zero and must be in sequence (the first non-existing index stops the evaluation). The array should not mix the array or values and array of objects. The decision is made at the first item (index=0) whether it's value or object.

The implementation of binding treats the System.Boolean values the special way - if there is no value, but existing key, the value is converted to true. This is useful when the command line arguments are used like flags. For example having the argument -p:SkipStep1 and prefix -p: , the binding a bool property SkipStep1 will set the value of the property to true (doesn't change the configuration item itself). Of course, it's still possible to use the syntax -p:SkipStep1=true or -p:SkipStep1=false even in this case.

As the binding uses the reflection, it's quite expensive operation, so by default, the bound objects are cached (the cache key is the type of bound object, so binding the same type to different sections is not recommended ). It's possible to force the binding using the parameter of Bind<TOptionsContainer>(string, bool) method. In general, the recommended pattern is to Bind<TOptionsContainer>(string, bool) the configuration object after the configuration is built and then Retrieve<TOptionsContainer>() it from the cache when needed.

-

Package members

Configuration (Type)
Singleton holding the application configuration (options)
instance (Field)
Instance of the Configuration created when the singleton is first touched
Instance (Property)
Public Configuration instance
Configuration() (Method)
Static constructor
Configuration() (Method)
Private constructor used to build the singleton instance
Items (Property)
Configuration items stored as key-value pairs
Get(string) (Method)
Gets the configuration item by key
Get<TValueType>(string, Configuration.TValueType) (Method)
Gets the typed configuration item by key . Returns the default value, that can be provided or is default to given TValueType The function tries to convert the value to TValueType using System.Convert.ChangeType(System.Object,System.Type) if the conversion is not successful, the default is returned.
bindingsCache (Field)
Cache for bindings. Dictionary of type bound as a key and the bound object as value.
Bind<TOptionsContainer>(string, bool) (Method)
Binds the configuration to given TOptionsContainer type and returns the bound object of such type. The resulting configuration object is stored to the cache and can be later on retrieved using Retrieve<TOptionsContainer>()
Retrieve<TOptionsContainer>() (Method)
Retrieves the configuration object of given TOptionsContainer that has been bound and cached before. The new instance of TOptionsContainer is created when the type not found in cache
Bind(Type, string) (Method)
Creates a new object with given type and binds the configuration to its public properties where possible.
GetSection(string) (Method)
Gets the configuration sub-tree that belongs to given section. The keys returned are relative to given section! When the section is not provided, the whole configuration tree is returned.
TryConvertValue(Type, object, object) (Method)
Tries to convert sourceValue to targetType . The converted values is returned in targetValue out parameter, the result of conversion is the function return value.
AddOrUpdateItem(string, object) (Method)
Add a new configuration item with given value or updates its value if the key already exists.
Builder() (Method)
Clears the configuration items and binding cache and creates a new instance of Configuration.ConfigurationBuilder
Configuration.ConfigurationBuilder (Type)
Configuration builder providing the methods for adding the configuration items from individual sources
Build() (Method)
Finishes the configuration building and returns the Instance
Add(string, object) (Method)
Add a new configuration item with given value or updates its value if the key already exists.
AddEnvironmentVariables() (Method)
Adds all environment variables into the Configuration . When a configuration item exists, the value is updated.
AddCommandLineArguments(string[]) (Method)
Adds the command line arguments starting with prefixes into the Configuration . When a configuration item exists, the value is updated.
AddJsonFile(string, bool, bool) (Method)
Loads the configuration items from JSON file, keeping the hierarchy of JSON objects (and arrays) When a configuration item exists, the value is updated.

-

Sources

config\Configuration.cs

-

Go to namespaces or types or source-only packages

-

RadCommons.di.Component Source only package

Tags: RadCommons source-only RadCommons-DI dependency-injection components
Includes: Folder
Declaring file: di\component\_SourceOnlyPackage.cs

RadCommons DI Component - allows to mark and inject the component using the class attributes (Source only package).

-

Usings

RadCommons.logging.CommonLogging
RadCommons.di.Component

References needed

Autofac

Package members

ComponentAttribute (Type)
Marks the decorated class as a component that will be available from the service locator / component container.
RegisterAs (Property)
Type to use for the component registration.
ImplicitRegistrationType (Property)
Flag how to do the implicit registration when no types are explicitly defined
Scope (Property)
Defines the instance scope
ComponentAttribute(ComponentAttribute.ImplicitRegistrationTypeEnum, ComponentAttribute.ScopeEnum) (Method)
Initializes a new instance of the ComponentAttribute class, marking the decorated class as a component that will be available from the component container, registered as the concrete type or with all implemented interfaces as well if specified.
ComponentAttribute(Type, ComponentAttribute.ScopeEnum) (Method)
Initializes a new instance of the ComponentAttribute class, marking the decorated class as a component that will be available from the component container using the specified registerAs type.
ComponentAttribute(Type[], ComponentAttribute.ScopeEnum) (Method)
Initializes a new instance of the ComponentAttribute class, marking the decorated class as a component that will be available from the component container using the specified registerAs types.
ComponentAttribute(Type[], net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum?, ComponentAttribute.ScopeEnum) (Method)
Initializes a new instance of the ComponentAttribute class, marking the decorated class as a component that will be available from the component container using the specified registerAs types.
ComponentAttribute.ScopeEnum (Type)
Component scope
InstancePerDependency (Field)
Transient scope (instance per dependency)
Transient (Field)
Transient scope (instance per dependency)
SingleInstance (Field)
Singleton
Singleton (Field)
Singleton
InstancePerLifetimeScope (Field)
Instance per lifetime scope
InstancePerRequest (Field)
Instance per request (scoped)
Scoped (Field)
Instance per request (scoped)
ComponentAttribute.ImplicitRegistrationTypeEnum (Type)
Kind of the implicit component registration
Self (Field)
Register as self (type) only
ImplementedInterfaces (Field)
Register as all implemented interfaces
SelfAndImplementedInterfaces (Field)
Register as self (type) and all implemented interfaces
ContainerBuilderExtensions (Type)
Autofac Autofac.ContainerBuilder extensions
AddServicesWithComponentAttribute(ContainerBuilder, Assembly[]) (Method)
Adds classes from the assemblies having the ComponentAttribute into Autofac container builder
AddServicesWithComponentAttribute(ContainerBuilder, Type[]) (Method)
Adds classes from array of types having the ComponentAttribute into Autofac container builder
Register<TLimit,TActivatorData,TRegistrationStyle>(IRegistrationBuilder<TLimit,TActivatorData,TRegistrationStyle>, Type, ComponentAttribute) (Method)
Registers the type with componentAttribute using the Autofac container builder
GetImplementedInterfaces(Type) (Method)
Gets the array of interfaces implemented by given type except the System.IDisposable interface
NamedComponentRegistrationAttribute (Type)
Defines the registration name and type for named registration (component type will be used if null)
Name (Property)
Registration name
Type (Property)
Registrations type for named registration. Component type will be used if null
NamedComponentRegistrationAttribute(string) (Method)
Named registration with component type used
NamedComponentRegistrationAttribute(string, Type) (Method)
Defines the registration name and type for named registration (component type will be used if null)

Sources

di\component\_SourceOnlyPackage.cs
di\component\ComponentAttribute.cs
di\component\ContainerBuilderExtensions.cs
di\component\NamedComponentRegistrationAttribute.cs

@@ -4883,9 +3292,9 @@

RadCommons.di.Config Includes: FolderRecursive
Declaring file: di\config\_SourceOnlyPackage.cs

RadCommons DI helpers for application configuration (Source only package).

-

Usings

RadCommons.logging.CommonLogging

+

Usings

RadCommons.logging.CommonLogging

References needed

Autofac
Microsoft.Extensions.Configuration
Microsoft.Extensions.DependencyInjection

-

Package members

AutoOptionsAttribute (Type)
Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI
RegisterDirect (Property)
Flag whether to create and registers the options class instance into MS DI
ConfigSection (Property)
Path to the section within appsettings.json
AutoOptionsAttribute(string, bool) (Method)
Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI
ServiceCollectionAutoOptionsException (Type)
Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionAutoOptionsExtension
ServiceCollectionAutoOptionsException() (Method)
Creates ServiceCollectionAutoOptionsException
ServiceCollectionAutoOptionsException(string) (Method)
Creates ServiceCollectionAutoOptionsException
ServiceCollectionAutoOptionsException(string, Exception) (Method)
Creates ServiceCollectionAutoOptionsException
ServiceCollectionConfigureDirectException (Type)
Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionConfigureDirectExtensions
ServiceCollectionConfigureDirectException() (Method)
Creates ServiceCollectionConfigureDirectException
ServiceCollectionConfigureDirectException(string) (Method)
Creates ServiceCollectionConfigureDirectException
ServiceCollectionConfigureDirectException(string, Exception) (Method)
Creates ServiceCollectionConfigureDirectException
ContainerBuilderExtensions (Type)
Autofac Autofac.ContainerBuilder extensions
AddAutoOptions(ContainerBuilder, IConfigurationRoot, Assembly[]) (Method)
Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions
AddAutoOptions(ContainerBuilder, IConfigurationRoot, Type[]) (Method)
Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions
AddOptions<TOptions>(ContainerBuilder, IConfigurationRoot, string) (Method)
Creates and registers the singleton of configuration (options) class of given type This is to be used if not registered using the AutoOptionsAttribute
ServiceCollectionAutoOptionsExtension (Type)
Extensions for options (configuration) class automatic binding to appsettings.json
Logger (Field)
ConfigureAutoOptions(IServiceCollection, IConfigurationRoot, Assembly[]) (Method)
Scans given assemblies for classes marked with AutoOptionsAttribute and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI
ConfigureAutoOptions(IServiceCollection, IConfiguration, Assembly[]) (Method)
Scans given assemblies for classes marked with AutoOptionsAttribute and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI
ServiceCollectionConfigureDirectExtensions (Type)
Extensions for options (configuration) class registration into MS DI
ConfigureDirect(IServiceCollection, Type, IConfiguration) (Method)
Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI.
ConfigureDirect<TConfig>(IServiceCollection, IConfiguration) (Method)
Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI.
ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, Func<TConfig>) (Method)
Gets the instance of the options (configuration) class from pocoProvider , binds (fills) it to the configuration and registers is as singleton into MS DI.
ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, ServiceCollectionConfigureDirectExtensions.TConfig) (Method)
Binds (fills) given instance of the options (configuration) class to configuration and registers is as singleton into MS DI.

+

Package members

AutoOptionsAttribute (Type)
Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI
RegisterDirect (Property)
Flag whether to create and registers the options class instance into MS DI
ConfigSection (Property)
Path to the section within appsettings.json
AutoOptionsAttribute(string, bool) (Method)
Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI
ServiceCollectionAutoOptionsException (Type)
Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionAutoOptionsExtension
ServiceCollectionAutoOptionsException() (Method)
Creates ServiceCollectionAutoOptionsException
ServiceCollectionAutoOptionsException(string) (Method)
Creates ServiceCollectionAutoOptionsException
ServiceCollectionAutoOptionsException(string, Exception) (Method)
Creates ServiceCollectionAutoOptionsException
ServiceCollectionConfigureDirectException (Type)
Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionConfigureDirectExtensions
ServiceCollectionConfigureDirectException() (Method)
Creates ServiceCollectionConfigureDirectException
ServiceCollectionConfigureDirectException(string) (Method)
Creates ServiceCollectionConfigureDirectException
ServiceCollectionConfigureDirectException(string, Exception) (Method)
Creates ServiceCollectionConfigureDirectException
ContainerBuilderExtensions (Type)
Autofac Autofac.ContainerBuilder extensions
AddAutoOptions(ContainerBuilder, IConfigurationRoot, Assembly[]) (Method)
Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions
AddAutoOptions(ContainerBuilder, IConfigurationRoot, Type[]) (Method)
Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions
AddOptions<TOptions>(ContainerBuilder, IConfigurationRoot, string) (Method)
Creates and registers the singleton of configuration (options) class of given type This is to be used if not registered using the AutoOptionsAttribute
ServiceCollectionAutoOptionsExtension (Type)
Extensions for options (configuration) class automatic binding to appsettings.json
ConfigureAutoOptions(IServiceCollection, IConfigurationRoot, Assembly[]) (Method)
Scans given assemblies for classes marked with AutoOptionsAttribute and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI
ConfigureAutoOptions(IServiceCollection, IConfiguration, Assembly[]) (Method)
Scans given assemblies for classes marked with AutoOptionsAttribute and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI
ServiceCollectionConfigureDirectExtensions (Type)
Extensions for options (configuration) class registration into MS DI
ConfigureDirect(IServiceCollection, Type, IConfiguration) (Method)
Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI.
ConfigureDirect<TConfig>(IServiceCollection, IConfiguration) (Method)
Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI.
ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, Func<TConfig>) (Method)
Gets the instance of the options (configuration) class from pocoProvider , binds (fills) it to the configuration and registers is as singleton into MS DI.
ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, ServiceCollectionConfigureDirectExtensions.TConfig) (Method)
Binds (fills) given instance of the options (configuration) class to configuration and registers is as singleton into MS DI.

Sources

di\config\_SourceOnlyPackage.cs
di\config\AutoOptionsAttribute.cs
di\config\exception\ServiceCollectionAutoOptionsException.cs
di\config\exception\ServiceCollectionConfigureDirectException.cs
di\config\extensions\ContainerBuilderExtensions.cs
di\config\extensions\ServiceCollectionAutoOptionsExtension.cs
di\config\extensions\ServiceCollectionConfigureDirectExtensions.cs

Go to namespaces or types or source-only packages

@@ -4894,9 +3303,9 @@

RadCommons.di.Post Includes: Folder
Declaring file: di\postinit\_SourceOnlyPackage.cs

RadCommons DI PostInit - allows to run post init method of component (Source only package).

-

Usings

RadCommons.logging.CommonLogging
RadCommons.di.Component

+

Usings

RadCommons.di.Component

References needed

Autofac

-

Package members

ContainerBuilderExtensions (Type)
Autofac Autofac.ContainerBuilder extensions
Logger (Field)
Logger
AddComponentPostInitSupport(ContainerBuilder) (Method)
Adds the support of PostInitAttribute to the Autofac container builder.
ProcessComponentPostInit(IContainer) (Method)
Executes the components' post init methods
PostInitAttribute (Type)
Allows to run post init method of component. Component must be registered using the Component attribute as singleton in root scope and must register self Parameters of "marked" post init method are resolved from container (throws an exception on failure)

+

Package members

ContainerBuilderExtensions (Type)
Autofac Autofac.ContainerBuilder extensions
AddComponentPostInitSupport(ContainerBuilder) (Method)
Adds the support of PostInitAttribute to the Autofac container builder.
ProcessComponentPostInit(IContainer) (Method)
Executes the components' post init methods
PostInitAttribute (Type)
Allows to run post init method of component. Component must be registered using the Component attribute as singleton in root scope and must register self Parameters of "marked" post init method are resolved from container (throws an exception on failure)

Sources

di\postinit\_SourceOnlyPackage.cs
di\postinit\ContainerBuilderExtensions.cs
di\postinit\PostInitAttribute.cs

Go to namespaces or types or source-only packages

@@ -4990,43 +3399,6 @@

namespaces or types or source-only packages

-

RadCommons.logging.CommonLogging Source only package

-

Tags: RadCommons source-only logging NLog
-Includes: Folder
-Declaring file: logging\_SourceOnlyPackage.cs

-

RadCommons logging wrapper around NLog with some extended functionality (Source only package).

-

References needed

NLog

-

Remarks

-

The NLog supports having additional (custom) event properties provided to loggers and optionally rendered to logs. The event properties are represented as key-value dictionary, where key is the unique name of the property.

Extended logger provides following methods to log with given set of the properties.

- - - -

Sometimes, it's useful to have an exception logging method implemented as the operation returning the exception being logged. The ErrorPassThrough(Exception, string) and FatalPassThrough(Exception, string) methods will log given exception and return it for further processing.

    try
-    {
-      ...
-    }
-    catch (Exception ex){
-       if(logger.ErrorPassThrough(ex) is MyException){
-         return null;
-       }else{
-         throw;
-       } 
-    }
In the example above, the exception is always logged and then the decision/action is taken.

C# 6 brought the exception filters that don't unwind the stack as the exception is not catch yet when processing the filter. It can also be used for logging the exceptions without actually catching them (when the exception filter returns false ). Extended logger provides functions ErrorFltr<TException>(ILogger.TException, string, bool) and FatalFltr<TException>(ILogger.TException, string, bool) for this purpose.

    try
-    {
-      ...
-    }
-    catch (Exception ex) when (logger.ErrorFltr(ex,"Error here!"){
-      //newer called as the default return value of ErrorFltr is false     
-    }
The example above logs but never catch all exceptions. The following code catch and log the ArgumentException and logs any other exception without catching it.
    try
-    {
-      ...
-    }
-    catch (ArgumentException e) when (Logger.ErrorFltr(e,catchIt:true)) { ... }
-    catch (Exception e) when (Logger.FatalFltr(e)) {}

Logger can also create and exception, log it and return using functions Error<TException>(string, Exception) and Fatal<TException>(string, Exception)

    if(value is null) throw logger.Fatal<ArgumentNullException>("Value is null");

When logging an exception using the LoggerExt methods, the event property StackTrace is set from System.Exception.StackTrace , when the logger creates an exception, the property is set using new StackTrace(2, true).ToString() . In other cases when the System.Exception.StackTrace is null or empty, new StackTrace(true).ToString() is used.

LoggerExt also provides set of methods for logging with the correlation ID (for example in integration scenarios), where the given correlation ID is set to the event property CorrelationId . Such methods have the name ending with Corr suffix.

-

Package members

CommonLogging (Type)
ILogger factory
CreateLogger(string) (Method)
Creates the logger with given categoryName
CreateLogger(Type) (Method)
Creates the logger for given type. The name of the logger will be System.Type.FullName
CreateLogger<T>() (Method)
Creates the logger for given type. The name of the logger will be System.Type.FullName
ILogger (Type)
Logger interface - wrapper around the NLog.ILogger with some additional methods
TraceCorr(string, string) (Method)
Writes the diagnostic message at the Trace level with correlation ID.
DebugCorr(string, string) (Method)
Writes the diagnostic message at the Debug level with correlation ID.
InfoCorr(string, string) (Method)
Writes the diagnostic message at the Info level with correlation ID.
WarnCorr(string, string) (Method)
Writes the diagnostic message at the Warn level with correlation ID.
ErrorCorr(string, string) (Method)
Writes the diagnostic message at the Error level with correlation ID.
FatalCorr(string, string) (Method)
Writes the diagnostic message at the Fatal level with correlation ID.
WarnCorr(string, Exception, string) (Method)
Writes the diagnostic message at the Warn level with correlation ID.
ErrorCorr(string, Exception, string) (Method)
Writes the diagnostic message at the Error level with correlation ID.
FatalCorr(string, Exception, string) (Method)
Writes the diagnostic message at the Fatal level with correlation ID.
ErrorCorr<TException>(string, ILogger.TException, string) (Method)
Writes the diagnostic message at the Error level and returns the exception of given type
FatalCorr<TException>(string, ILogger.TException, string) (Method)
Writes the diagnostic message at the Fatal level and returns the exception of given type
ErrorCorr<TException>(string, string, Exception) (Method)
Writes the diagnostic message at the Error level with correlation ID. Creates and returns the exception of given type
FatalCorr<TException>(string, string, Exception) (Method)
Writes the diagnostic message at the Fatal level with correlation ID. Creates and returns the exception of given type
ErrorFltrCorr<TException>(string, ILogger.TException, string, bool) (Method)
Writes the diagnostic message at the Error level and returns the exception of given type
FatalFltrCorr<TException>(string, ILogger.TException, string, bool) (Method)
Writes the diagnostic message at the Fatal level and returns catchIt value.
ILogger (Type)
Logger interface - wrapper around the NLog.ILogger with some additional methods
ILogger (Type)
Logger interface - wrapper around the NLog.ILogger with some additional methods
Trace(Dictionary<string,object>, string) (Method)
Writes the diagnostic message at the Trace level.
Debug(Dictionary<string,object>, string) (Method)
Writes the diagnostic message at the Debug level.
Info(Dictionary<string,object>, string) (Method)
Writes the diagnostic message at the Info level.
Warn(Dictionary<string,object>, string) (Method)
Writes the diagnostic message at the Warn level.
Error(Dictionary<string,object>, string) (Method)
Writes the diagnostic message at the Error level.
Fatal(Dictionary<string,object>, string) (Method)
Writes the diagnostic message at the Fatal level.
Warn(Dictionary<string,object>, Exception, string) (Method)
Writes the diagnostic message at the Warn level.
Error(Dictionary<string,object>, Exception, string) (Method)
Writes the diagnostic message at the Error level.
Fatal(Dictionary<string,object>, Exception, string) (Method)
Writes the diagnostic message at the Fatal level.
ILogger (Type)
Logger interface - wrapper around the NLog.ILogger with some additional methods
ErrorFltr<TException>(ILogger.TException, string, bool) (Method)
Writes the diagnostic message at the Error level and returns the exception of given type
FatalFltr<TException>(ILogger.TException, string, bool) (Method)
Writes the diagnostic message at the Fatal level and returns catchIt value.
ILogger (Type)
Logger interface - wrapper around the NLog.ILogger with some additional methods
ErrorPassThrough(Exception, string) (Method)
Writes the diagnostic message at the Error level and returns given exception
FatalPassThrough(Exception, string) (Method)
Writes the diagnostic message at the Fatal level and returns given exception
Error<TException>(string, Exception) (Method)
Writes the diagnostic message at the Error level. Creates and returns the exception of given type
Fatal<TException>(string, Exception) (Method)
Writes the diagnostic message at the Fatal level. Creates and returns the exception of given type
LoggerExt (Type)
Extended logger implementing ILogger
TraceCorr(string, string) (Method)
Writes the diagnostic message at the Trace level with correlation ID
DebugCorr(string, string) (Method)
Writes the diagnostic message at the Debug level with correlation ID.
InfoCorr(string, string) (Method)
Writes the diagnostic message at the Info level with correlation ID.
WarnCorr(string, string) (Method)
Writes the diagnostic message at the Warn level with correlation ID.
ErrorCorr(string, string) (Method)
Writes the diagnostic message at the Error level with correlation ID.
FatalCorr(string, string) (Method)
Writes the diagnostic message at the Fatal level with correlation ID.
WarnCorr(string, Exception, string) (Method)
Writes the diagnostic message at the Warn level with correlation ID.
ErrorCorr(string, Exception, string) (Method)
Writes the diagnostic message at the Error level with correlation ID.
FatalCorr(string, Exception, string) (Method)
Writes the diagnostic message at the Fatal level with correlation ID.
ErrorCorr<TException>(string, LoggerExt.TException, string) (Method)
Writes the diagnostic message at the Error level and returns the exception of given type
FatalCorr<TException>(string, LoggerExt.TException, string) (Method)
Writes the diagnostic message at the Fatal level and returns the exception of given type
ErrorCorr<TException>(string, string, Exception) (Method)
Writes the diagnostic message at the Error level with correlation ID. Creates and returns the exception of given type
FatalCorr<TException>(string, string, Exception) (Method)
Writes the diagnostic message at the Fatal level with correlation ID. Creates and returns the exception of given type
ErrorFltrCorr<TException>(string, LoggerExt.TException, string, bool) (Method)
Writes the diagnostic message at the Error level and returns the exception of given type
FatalFltrCorr<TException>(string, LoggerExt.TException, string, bool) (Method)
Writes the diagnostic message at the Fatal level and returns catchIt value.
LogIt(LogLevel, string, string, Exception, string) (Method)
Writes the item (message with optional exception) with correlation Id into the log
LoggerExt (Type)
Extended logger implementing ILogger
CreateException<TException>(string, string, Exception) (Method)
Writes the diagnostic message at the Fatal level. Creates and returns the exception of given type
LogIt(LogLevel, string, Exception, string) (Method)
Writes the item (message with optional exception) into the log
LogIt(LogLevel, Dictionary<string,object>, string, Exception, string) (Method)
Writes the item (message with optional event properties and exception) into the log
LoggerExt (Type)
Extended logger implementing ILogger
Trace(Dictionary<string,object>, string) (Method)
Writes the diagnostic message at the Trace level.
Debug(Dictionary<string,object>, string) (Method)
Writes the diagnostic message at the Debug level.
Info(Dictionary<string,object>, string) (Method)
Writes the diagnostic message at the Info level.
Warn(Dictionary<string,object>, string) (Method)
Writes the diagnostic message at the Warn level.
Error(Dictionary<string,object>, string) (Method)
Writes the diagnostic message at the Error level.
Fatal(Dictionary<string,object>, string) (Method)
Writes the diagnostic message at the Fatal level.
Warn(Dictionary<string,object>, Exception, string) (Method)
Writes the diagnostic message at the Warn level.
Error(Dictionary<string,object>, Exception, string) (Method)
Writes the diagnostic message at the Error level.
Fatal(Dictionary<string,object>, Exception, string) (Method)
Writes the diagnostic message at the Fatal level.
LoggerExt (Type)
Extended logger implementing ILogger
ErrorFltr<TException>(LoggerExt.TException, string, bool) (Method)
Writes the diagnostic message at the Error level and returns the exception of given type
FatalFltr<TException>(LoggerExt.TException, string, bool) (Method)
Writes the diagnostic message at the Fatal level and returns catchIt value.
LoggerExt (Type)
Extended logger implementing ILogger
ErrorPassThrough(Exception, string) (Method)
Writes the diagnostic message at the Error level and returns given exception
FatalPassThrough(Exception, string) (Method)
Writes the diagnostic message at the Fatal level and returns given exception >
Error<TException>(string, Exception) (Method)
Writes the diagnostic message at the Error level. Creates and returns the exception of given type
Fatal<TException>(string, Exception) (Method)
Writes the diagnostic message at the Fatal level. Creates and returns the exception of given type

-

Sources

logging\_SourceOnlyPackage.cs
logging\CommonLogging.cs
logging\ILogger.CorrelationId.cs
logging\ILogger.cs
logging\ILogger.EventProperties.cs
logging\ILogger.ExceptionFilter.cs
logging\ILogger.ExceptionPassThrough.cs
logging\LoggerExt.CorrelationId.cs
logging\LoggerExt.cs
logging\LoggerExt.EventProperties.cs
logging\LoggerExt.ExceptionFilter.cs
logging\LoggerExt.ExceptionPassThrough.cs

-

Go to namespaces or types or source-only packages

-

RadCommons.utils.BackgroundWorkerWithSyncCancel Source only package

Tags: RadCommons source-only worker background-worker
Includes: None
@@ -5036,15 +3408,6 @@

Sources
utils\BackgroundWorkerWithSyncCancel.cs

Go to namespaces or types or source-only packages

-

RadCommons.utils.BaseDisposable Source only package

-

Tags: RadCommons source-only disposable
-Includes: None
-Declaring file: utils\BaseDisposable.cs

-

Helper class for implementation of IDisposable types (Source only package).

-

Package members

BaseDisposable (Type)
Helper class for implementation of System.IDisposable types
DisposedFlag (Field)
Internal flag whether the object is fully disposed
isDisposed (Field)
The object is disposed when equals to DisposedFlag
Disposed (Property)
Returns
true
when the object is fully disposed
DisposedManaged (Property)
Returns
true
when the managed resources are disposed
DisposedNative (Property)
Returns
true
when the native resources are disposed
Dispose() (Method)
Dispose the object
Dispose(bool) (Method)
Internal implementation of dispose - free the managed and native resources using the respective methods
DisposeManaged() (Method)
Dispose any disposable managed fields or properties.
DisposeNative() (Method)
Dispose of COM objects, Handles, etc. Then set those objects to null.
~BaseDisposable() (Method)
AssertNotDisposed(string) (Method)
Throws an System.ObjectDisposedException when the current object is disposed

-

Sources

utils\BaseDisposable.cs

-

Go to namespaces or types or source-only packages

-

RadCommons.utils.ConsoleUtils Source only package

Tags: RadCommons source-only console
Includes: None
@@ -5068,7 +3431,8 @@

RadCommons.utils Inherit from the Context to add the context related operations (inherited classes have the access to state). Based on the implementation of Guard Scopes by https://github.com/safakgur. (Source only package).

-

Usings

RadCommons.utils.BaseDisposable
RadCommons.utils.Disposer

+

Usings

RadCommons.utils.Disposer

+

References needed

RadCommons.core

Remarks

The context can be both state-less and state-full and it's valid until it's disposed. The current context is accessible via Current . The contexts are chained, when a new context is created using BeginContext(Context<TState>.TState) , the Current context became the Parent of the new one and the newly created context will be set as the Current one. When the context is disposed, the Current context is set to Parent of disposing context. Context's children are disposed as well during the context disposal. The AddToDisposer(IDisposable) method is to be used in inherited classes whenever they manage any disposable resource to ensure their proper life time (when the State is System.IDisposable , it's added to disposer automatically).

The base implementation just manages the life time, context chain and keeps the state (when provided). Inherit from the Context<TState> to add the context related operations (inherited classes have the access to State ).

Based on the implementation of Guard Scopes by https://github.com/safakgur at https://github.com/safakgur/guard/blob/v1.7.0/src/Guard.Scopes.cs

Package members

Context<TState> (Type)
Base context implementation.
ContextDisposedMessage (Field)
Error message that will be put into the exception when there will be any operation on the disposed context.
Local (Field)
The context holder that is local to the calling asynchronous control flow.
Current (Property)
Gets the current context.
Disposer (Property)
Gets the disposer associated with this container.
parentContext (Field)
Parent context.
Parent (Property)
Gets the parent scope.
contextState (Field)
State managed by the context.
State (Property)
Gets the state managed by the context.
Context<TState>(Context<TState>.TState) (Method)
Creates an instance of Context<TState> and initialize its Disposer . The new context will become Current and the previous one its Parent .
BeginContext(Context<TState>.TState) (Method)
Creates a new Context<TState> within the context chain. The new context will become Current and the previous one its Parent .
AddToDisposer(IDisposable) (Method)
Adds the disposable object to the context disposer, so it will be disposed with the context
DisposeManaged() (Method)
Dispose any disposable managed objects - all disposables kept in Disposer stack are pop and disposed.

The Parent context of the disposing one will become the new Current context.

@@ -5080,7 +3444,7 @@

RadCommons.util Includes: None
Declaring file: utils\Disposer.cs

Keeps the stack of disposable objects, and disposes them when the disposer is being disposed. (Source only package).

-

Usings

RadCommons.utils.BaseDisposable

+

References needed

RadCommons.core

Package members

Disposer (Type)
Keeps the stack of disposable objects, and disposes them when the disposer is being disposed.
disposables (Field)
Stack of disposables kept by the Disposer .
lockObj (Field)
Lock object
Dispose(bool) (Method)
Internal implementation of dispose - free the managed and native resources.
Add(IDisposable) (Method)
Adds the disposable object to the disposer.

Sources

utils\Disposer.cs

Go to namespaces or types or source-only packages

@@ -5140,7 +3504,8 @@

RadCommons.utils.S Inherit from the Scope (and IScope) to add the scope related operations (inherited classes have the access to state). (Source only package).

-

Usings

RadCommons.utils.BaseDisposable
RadCommons.utils.Disposer

+

Usings

RadCommons.utils.Disposer

+

References needed

RadCommons.core

Remarks

The scope can be both state-less and state-full and it's valid until it's disposed. The scopes can be nested, when the scope is disposed, the children are disposed as well. There can be multiple child scopes (siblings) living in parallel. The AddToDisposer(IDisposable) method is to be used in inherited classes whenever they manage any disposable resource to ensure the proper life time (when the State is System.IDisposable , it's added to disposer automatically).

The base implementation just manages the life time, child scopes and keeps the state (when provided). Inherit from the Scope<TState> (and IScope<TState> ) to add the scope related operations (inherited classes have the access to State ).

Package members

IScope<TState> (Type)
Scope interface.
Parent (Property)
Gets the parent scope.
BeginScope(IScope<TState>.TState) (Method)
Creates a child scope of the current scope.
Scope<TState> (Type)
Base scope implementation.
ScopeDisposedMessage (Field)
Error message that will be put into the exception when there will be any operation on the disposed scope.
RootInternal (Field)
Instance of the Scope<TState> created when the singleton is first touched - root scope with default State
Root (Property)
Gets the root scope.
Scope<TState>() (Method)
Static constructor
Disposer (Property)
Gets the disposer associated with this container.
parentScope (Field)
Parent scope.
Parent (Property)
Gets the parent scope.
scopeState (Field)
State managed by the scope.
State (Property)
Gets the state managed by the scope.
Scope<TState>(Scope<TState>.TState) (Method)
Creates an instance of Scope<TState> and initialize its Disposer .
Scope<TState>(IScope<TState>, Scope<TState>.TState) (Method)
Creates an instance of child Scope<TState> .
BeginScope(Scope<TState>.TState) (Method)
Creates a child scope of the current scope.
AddToDisposer(IDisposable) (Method)
Adds the disposable object to the scope disposer, so it will be disposed with the scope
DisposeManaged() (Method)
Dispose any disposable managed objects - all disposables kept in Disposer stack are pop and disposed.

diff --git a/doc/net.adamec.lib.common.md b/doc/net.adamec.lib.common.md index bf53980..dd80071 100644 --- a/doc/net.adamec.lib.common.md +++ b/doc/net.adamec.lib.common.md @@ -4,14 +4,12 @@ | Name | Summary | | ------ | --------- | | [net.adamec.lib.common.async](#n-net.adamec.lib.common.async__17zxv10) | | - | [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) | | | [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) | | | [net.adamec.lib.common.di.config](#n-net.adamec.lib.common.di.config__3709lb) | | | [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) | | | [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) | | | [net.adamec.lib.common.di.postinit](#n-net.adamec.lib.common.di.postinit__ylne5f) | | | [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) | | - | [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) | | | [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) | | ## Types ## @@ -23,11 +21,7 @@ | [AsyncManager.ExclusiveSynchronizationContext](#t-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext__jzepyu) | private | Class | "Private" synchronization context used to run the async method | | [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) | public | Class | Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI | | [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) | public | Class | Executes an operation on a separate thread with possibility of sync cancel. | - | [BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) | public abstract | Class | Helper class for implementation of System.IDisposable types | - | [CommonLogging](#t-net.adamec.lib.common.logging.commonlogging__1dar5wb) | internal static | Class | [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) factory | | [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) | public | Class | Marks the decorated class as a component that will be available from the service locator / component container. | - | [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) | public | Class | Singleton holding the application configuration (options) | - | [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj) | public | Class | Configuration builder providing the methods for adding the configuration items from individual sources | | [ConsoleUtils](#t-net.adamec.lib.common.utils.consoleutils__8nc415) | internal static | Class | Console output helpers | | [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.component.containerbuilderextensions__lgbl4y) | internal static | Class | Autofac Autofac.ContainerBuilder extensions | | [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.config.extensions.containerbuilderextensions__tpisv7) | internal static | Class | Autofac Autofac.ContainerBuilder extensions | @@ -38,7 +32,6 @@ | [FileAsync](#t-net.adamec.lib.common.async.fileasync__158f1hu) | internal static | Class | Asynchronous text/lines file read methods https://stackoverflow.com/a/13168006 | | [FileUtils](#t-net.adamec.lib.common.utils.fileutils__1bi9r8y) | internal static | Class | File copy utilities | | [IEnumerableExtensions](#t-net.adamec.lib.common.extensions.ienumerableextensions__1a6urvh) | internal static | Class | System.Collections.Generic.IEnumerable`1 extensions | - | [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) | internal | Class | Extended logger implementing [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) | | [MarshalExt](#t-net.adamec.lib.common.utils.marshalext__7jyavy) | internal static | Class | Marshaling helper methods | | [NamedComponentRegistrationAttribute](#t-net.adamec.lib.common.di.component.namedcomponentregistrationattribute__158ujcr) | public | Class | Defines the registration name and type for named registration (component type will be used if null) | | [PeriodicTask](#t-net.adamec.lib.common.utils.periodictask__1xfynj) | internal static | Class | Helper class allowing to execute periodic (or one time) scheduled action | @@ -55,7 +48,6 @@ | [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) | internal static | Class | System.String class extensions | | [Txt](#t-net.adamec.lib.common.utils.txt__1fch6k9) | public | Class | Text builder | | [TypeExtensions](#t-net.adamec.lib.common.extensions.typeextensions__63ezc8) | internal static | Class | System.Type extensions | - | [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) | internal abstract | Interface | Logger interface - wrapper around the NLog.ILogger with some additional methods | | [IScope<TState>](#t-net.adamec.lib.common.utils.iscope-1__88aydf) | internal abstract | Interface | Scope interface. | | [ProcessEventHandler](#t-net.adamec.lib.common.utils.processeventhandler__8h5v6w) | public | Delegate | A ProcessEventHandler is a delegate for process output events. | | [ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo) | public | Enum | Kind of the implicit component registration | @@ -73,7 +65,6 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame | ------ | --------- | | [RadCommons.async.AsyncManager](#src-only-package--RadCommons.async.AsyncManager) | Helpers for running the async tasks in sync mode and executing sync actions in async mode (Source only package). | | [RadCommons.async.FileAsync](#src-only-package--RadCommons.async.FileAsync) | Helpers for reading text files in async mode (Source only package). | - | [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) | Simple configuration container in case DI with more sophisticated containers is not used. Supports the JSON config files, command line arguments and environment variables as sources and their hierarchy/overrides. The configuration can be used as key-value pairs or bound to objects (Source only package). | | [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) | RadCommons DI Component - allows to mark and inject the component using the class attributes (Source only package). | | [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) | RadCommons DI helpers for application configuration (Source only package). | | [RadCommons.di.PostInit](#src-only-package--RadCommons.di.PostInit) | RadCommons DI PostInit - allows to run post init method of component (Source only package). | @@ -87,9 +78,7 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame | [RadCommons.extensions.StringExtensions.Paths](#src-only-package--RadCommons.extensions.StringExtensions.Paths) | Path manipulation helpers for strings (Source only package). | | [RadCommons.extensions.StringExtensions.Whitespace](#src-only-package--RadCommons.extensions.StringExtensions.Whitespace) | Whitespace manipulation helpers for strings (Source only package). | | [RadCommons.extensions.TypeExtensions.DefaultValue](#src-only-package--RadCommons.extensions.TypeExtensions.DefaultValue) | Provides default value for types (Source only package). | - | [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) | RadCommons logging wrapper around NLog with some extended functionality (Source only package). | | [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) | Executes an operation on a separate thread with possibility of sync cancel (Source only package). | - | [RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable) | Helper class for implementation of IDisposable types (Source only package). | | [RadCommons.utils.ConsoleUtils](#src-only-package--RadCommons.utils.ConsoleUtils) | Console output utilities (Source only package). | | [RadCommons.utils.Context](#src-only-package--RadCommons.utils.Context) | The runtime "container" for context operations. The context can be both state-less and state-full and it's valid until it's disposed. The current context is accessible via static property Current. The contexts are chained, when a new context is created using static method BeginContext(), the Current context became the Parent of the new one and the newly created context will be set as the Current one. When the context is disposed, the Current context is set to Parent of disposing context. The base implementation just manages the life time, context chain and keeps the state (when provided). Inherit from the Context to add the context related operations (inherited classes have the access to state). Based on the implementation of Guard Scopes by https://github.com/safakgur. (Source only package). | | [RadCommons.utils.Disposer](#src-only-package--RadCommons.utils.Disposer) | Keeps the stack of disposable objects, and disposes them when the disposer is being disposed. (Source only package). | @@ -148,8 +137,7 @@ Inheritance: -Default exception handler for [RunAsync(Action, Action<System.Exception>)](#m-net.adamec.lib.common.async.asyncmanager.runasync_system.action-system.action_system.exception____s187qk) . Catches and logs all exceptions during the task execution. +Default exception handler for [RunAsync(Action, Action<System.Exception>)](#m-net.adamec.lib.common.async.asyncmanager.runasync_system.action-system.action_system.exception____s187qk) . Catches all exceptions during the task execution. @@ -196,31 +184,6 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## AsyncManager.Logger Field ## -Namespace: [net.adamec.lib.common.async](#n-net.adamec.lib.common.async__17zxv10) -Assembly: net.adamec.lib.common -Type: [AsyncManager](#t-net.adamec.lib.common.async.asyncmanager__16s0tm9) -Sources: async\AsyncManager.cs -Source-only packages: [RadCommons.async.AsyncManager](#src-only-package--RadCommons.async.AsyncManager) - - -Logger - - - -```csharp -private static readonly ILogger Logger -``` - -Field value
[net.adamec.lib.common.logging.ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - ##
AsyncManager.RunAsync(Action, Action<System.Exception>) Method ## Namespace: [net.adamec.lib.common.async](#n-net.adamec.lib.common.async__17zxv10) Assembly: net.adamec.lib.common @@ -806,74 +769,62 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## net.adamec.lib.common.config Namespace ## +## net.adamec.lib.common.di.component Namespace ## ### Classes ### | Name | Modifier | Summary | | ------ | ---------- | --------- | - | [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) | public | Singleton holding the application configuration (options) | - | [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj) | public | Configuration builder providing the methods for adding the configuration items from individual sources | + | [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) | public | Marks the decorated class as a component that will be available from the service locator / component container. | + | [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.component.containerbuilderextensions__lgbl4y) | internal static | Autofac Autofac.ContainerBuilder extensions | + | [NamedComponentRegistrationAttribute](#t-net.adamec.lib.common.di.component.namedcomponentregistrationattribute__158ujcr) | public | Defines the registration name and type for named registration (component type will be used if null) | -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) +### Enums ### + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo) | public | Kind of the implicit component registration | + | [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) | public | Component scope | -## Configuration Class ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) -Assembly: net.adamec.lib.common -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) - - -Singleton holding the application configuration (options) - - - -```csharp -public sealed class Configuration -``` - -Inheritance: object - - - -### Remarks ### -This is the simple configuration container in case DI with more sophisticated containers is not used The configuration is stored as the key-value dictionary, supporting hierarchy using the dot separator and arrays.The arrays can contain values or another objects. Actually, mixed arrays of values and objects can be stored, but they are not supported for binding. For example `section1.option1` means the option1 available in section1, `section1.subSection2.option1` means the option1 available in section1.subSection2. `section1.option1[0]` means, that the option1 is array of values or objects (sections) within the section1. For arrays, the keys are like `OtherSection.SimpleArray[0]` or `OtherSection.ComplexObjectArray[0].Name` +Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) class provides a singleton instance, however the key functionality is provided via static functions, so no need to touch the [Instance](#p-net.adamec.lib.common.config.configuration.instance__131avv7) at all. The items can be retrieved by key using the [Get(string)](#m-net.adamec.lib.common.config.configuration.get_system.string___8ykaxa) and [Get<TValueType>(string, Configuration.TValueType)](#m-net.adamec.lib.common.config.configuration.get--1_system.string---0___1dcpnhz) methods. The first one returns null when the key is not found, the other one allow to define the default value to be returned, when the item is not found. - The inner class [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj) provides the methods to build the configuration from JSON config files, commandline arguments, environment values and/or direct entries. The static method [Builder()](#m-net.adamec.lib.common.config.configuration.builder__700lxw) clears the configuration items and binding cache and creates a new instance of [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj) allowing to build a configuration from scratch. The configuration is updated directly during the calls to builder methods, the existing items (keys) are updated, so it's possible to manage the priority of individual sources and the overrides if needed. The method [Build()](#m-net.adamec.lib.common.config.configuration.configurationbuilder.build__bwvls6) returns the configuration instance, breaking the fluent design of builder methods, however there is no other functionality within the method, so it's more the convention than need to use it at the end of configuration build. + - Configuration binding it the way, how to access the configuration using the configuration objects instead of querying the individual items by key. When the method [Bind<TOptionsContainer>(string, bool)](#m-net.adamec.lib.common.config.configuration.bind--1_system.string-system.boolean___16p0943) is used, it creates a new instance of given type and tries to map the public properties with public setter to the keys (using the "dot notation") within the [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) . It's possible to bind the object to to the root of the configuration to provide the whole configuration at once or bind it to the particular section to provide a configuration sub-tree. In general, the nested objects and both value and object arrays are supported. There are some rules when binding the arrays: The index must start with zero and must be in sequence (the first non-existing index stops the evaluation). The array should not mix the array or values and array of objects. The decision is made at the first item (index=0) whether it's value or object. - The implementation of binding treats the System.Boolean values the special way - if there is no value, but existing key, the value is converted to true. This is useful when the command line arguments are used like flags. For example having the argument `-p:SkipStep1` and prefix `-p:` , the binding a bool property `SkipStep1` will set the value of the property to `true` (doesn't change the configuration item itself). Of course, it's still possible to use the syntax `-p:SkipStep1=true` or `-p:SkipStep1=false` even in this case. +## ComponentAttribute Class ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) +Assembly: net.adamec.lib.common +Sources: di\component\ComponentAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - As the binding uses the reflection, it's quite expensive operation, so by default, the bound objects are cached (the cache key is the type of bound object, so binding the same type to different sections is not recommended ). It's possible to force the binding using the parameter of [Bind<TOptionsContainer>(string, bool)](#m-net.adamec.lib.common.config.configuration.bind--1_system.string-system.boolean___16p0943) method. In general, the recommended pattern is to [Bind<TOptionsContainer>(string, bool)](#m-net.adamec.lib.common.config.configuration.bind--1_system.string-system.boolean___16p0943) the configuration object after the configuration is built and then [Retrieve<TOptionsContainer>()](#m-net.adamec.lib.common.config.configuration.retrieve--1__1xuxip8) it from the cache when needed. +Marks the decorated class as a component that will be available from the service locator / component container. -### Fields ### +```csharp +[AttributeUsage(System.AttributeTargets.Class, AllowMultiple = false)] +public class ComponentAttribute : Attribute +``` - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [bindingsCache](#f-net.adamec.lib.common.config.configuration.bindingscache__thj354) | private | Cache for bindings. Dictionary of type bound as a key and the bound object as value. | - | [instance](#f-net.adamec.lib.common.config.configuration.instance__1aq1w9t) | private static | Instance of the [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) created when the singleton is first touched | +Inheritance: object -> Attribute +Attributes: System.AttributeUsageAttribute - ### Properties ### | Name | Modifier | Summary | | ------ | ---------- | --------- | - | [Instance](#p-net.adamec.lib.common.config.configuration.instance__131avv7) | public static | Public [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) instance | - | [Items](#p-net.adamec.lib.common.config.configuration.items__1i9u236) | private | Configuration items stored as key-value pairs | + | [ImplicitRegistrationType](#p-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtype__1mysue9) | public | Flag how to do the implicit registration when no types are explicitly defined | + | [RegisterAs](#p-net.adamec.lib.common.di.component.componentattribute.registeras__1m8nlcq) | public | Type to use for the component registration. | + | [Scope](#p-net.adamec.lib.common.di.component.componentattribute.scope__1h6i43p) | public | Defines the instance scope | @@ -882,25 +833,10 @@ This is the simple configuration container in case DI with more sophisticated co | Name | Modifier | Summary | | ------ | ---------- | --------- | - | [Configuration()](#m-net.adamec.lib.common.config.configuration.-cctor__1xl390h) | private static | Static constructor | - | [Configuration()](#m-net.adamec.lib.common.config.configuration.-ctor__11tp9ak) | private | Private constructor used to build the singleton instance | - - - - -### Methods ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [AddOrUpdateItem(string, object)](#m-net.adamec.lib.common.config.configuration.addorupdateitem_system.string-system.object___1atv1og) | private | Add a new configuration item with given value or updates its value if the key already exists. | - | [Bind(Type, string)](#m-net.adamec.lib.common.config.configuration.bind_system.type-system.string___1b0yb6e) | private static | Creates a new object with given type and binds the configuration to its public properties where possible. | - | [Bind<TOptionsContainer>(string, bool)](#m-net.adamec.lib.common.config.configuration.bind--1_system.string-system.boolean___16p0943) | public static | Binds the configuration to given TOptionsContainer type and returns the bound object of such type. The resulting configuration object is stored to the cache and can be later on retrieved using [Retrieve<TOptionsContainer>()](#m-net.adamec.lib.common.config.configuration.retrieve--1__1xuxip8) | - | [Builder()](#m-net.adamec.lib.common.config.configuration.builder__700lxw) | public static | Clears the configuration items and binding cache and creates a new instance of [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj) | - | [Get(string)](#m-net.adamec.lib.common.config.configuration.get_system.string___8ykaxa) | public static | Gets the configuration item by key | - | [Get<TValueType>(string, Configuration.TValueType)](#m-net.adamec.lib.common.config.configuration.get--1_system.string---0___1dcpnhz) | public static | Gets the typed configuration item by key . Returns the default value, that can be provided or is default to given TValueType The function tries to convert the value to TValueType using System.Convert.ChangeType(System.Object,System.Type) if the conversion is not successful, the default is returned. | - | [GetSection(string)](#m-net.adamec.lib.common.config.configuration.getsection_system.string___17z37ez) | private static | Gets the configuration sub-tree that belongs to given section. The keys returned are relative to given section! When the section is not provided, the whole configuration tree is returned. | - | [Retrieve<TOptionsContainer>()](#m-net.adamec.lib.common.config.configuration.retrieve--1__1xuxip8) | public static | Retrieves the configuration object of given TOptionsContainer that has been bound and cached before. The new instance of TOptionsContainer is created when the type not found in cache | - | [TryConvertValue(Type, object, object)](#m-net.adamec.lib.common.config.configuration.tryconvertvalue_system.type-system.object-system.object-___1f1lwmk) | private static | Tries to convert sourceValue to targetType . The converted values is returned in targetValue out parameter, the result of conversion is the function return value. | + | [ComponentAttribute(ComponentAttribute.ImplicitRegistrationTypeEnum, ComponentAttribute.ScopeEnum)](#m-net.adamec.lib.common.di.component.componentattribute.-ctor_net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum-net.adamec.lib.common.di.component.componentattribute.scopeenum___ex53ua) | public | Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container, registered as the concrete type or with all implemented interfaces as well if specified. | + | [ComponentAttribute(Type, ComponentAttribute.ScopeEnum)](#m-net.adamec.lib.common.di.component.componentattribute.-ctor_system.type-net.adamec.lib.common.di.component.componentattribute.scopeenum___1ubqgal) | public | Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container using the specified registerAs type. | + | [ComponentAttribute(Type[], ComponentAttribute.ScopeEnum)](#m-net.adamec.lib.common.di.component.componentattribute.-ctor_system.type__-net.adamec.lib.common.di.component.componentattribute.scopeenum___1rdjiuf) | public | Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container using the specified registerAs types. | + | [ComponentAttribute(Type[], net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum?, ComponentAttribute.ScopeEnum)](#m-net.adamec.lib.common.di.component.componentattribute.-ctor_system.type__-system.nullable_net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum_-net.adamec.lib.common.di.component.componentattribute.scopeenum___1h4ujev) | private | Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container using the specified registerAs types. | @@ -911,27 +847,23 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## Configuration.bindingsCache Field ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## ComponentAttribute.ImplicitRegistrationType Property ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) +Sources: di\component\ComponentAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Cache for bindings. Dictionary of type bound as a key and the bound object as value. +Flag how to do the implicit registration when no types are explicitly defined ```csharp -private readonly ConcurrentDictionary bindingsCache +public net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum? ImplicitRegistrationType { get; } ``` -Field value
System.Collections.Concurrent.ConcurrentDictionary<System.Type,object>
- - -### Remarks ### -Cache is used to prevent the "expensive" binding operation in case there is no need to refresh the bound configuration object +Property value
net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum?
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -940,27 +872,23 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## Configuration.instance Field ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## ComponentAttribute.RegisterAs Property ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) +Sources: di\component\ComponentAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Instance of the [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) created when the singleton is first touched +Type to use for the component registration. ```csharp -private static readonly Configuration instance +public Type[] RegisterAs { get; } ``` -Field value
[net.adamec.lib.common.config.Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk)
- - -### Remarks ### -Not using the auto-property to have better control, when the instance is created +Property value
System.Type[]
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -969,23 +897,23 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## Configuration.Instance Property ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## ComponentAttribute.Scope Property ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) +Sources: di\component\ComponentAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Public [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) instance +Defines the instance scope ```csharp -public static Configuration Instance { get; } +public ComponentAttribute.ScopeEnum Scope { get; } ``` -Property value
[net.adamec.lib.common.config.Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk)
+Property value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -994,135 +922,127 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -##
Configuration.Items Property ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## ComponentAttribute.ComponentAttribute(ComponentAttribute.ImplicitRegistrationTypeEnum, ComponentAttribute.ScopeEnum) Constructor ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) +Sources: di\component\ComponentAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Configuration items stored as key-value pairs +Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container, registered as the concrete type or with all implemented interfaces as well if specified. ```csharp -private ConcurrentDictionary Items { get; } +public ComponentAttribute(ComponentAttribute.ImplicitRegistrationTypeEnum implicitRegistrationType = 0, ComponentAttribute.ScopeEnum scope = 0) ``` -Property value
System.Collections.Concurrent.ConcurrentDictionary<string,object>
- - +Constructor parameters
[net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo) implicitRegistrationType
Flag how to do the implicit registration when no types are explicitly defined
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) scope
The instance scope
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## Configuration.Configuration() Constructor ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## ComponentAttribute.ComponentAttribute(Type, ComponentAttribute.ScopeEnum) Constructor ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) +Sources: di\component\ComponentAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Static constructor +Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container using the specified registerAs type. ```csharp -private static Configuration() +public ComponentAttribute(Type registerAs, ComponentAttribute.ScopeEnum scope = 0) ``` -### Remarks ### -Explicit static constructor to tell C# compiler not to mark type as beforefieldinit - - +Constructor parameters
System.Type registerAs
The type to use to register the decorated component.
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) scope
The instance scope
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## Configuration.Configuration() Constructor ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## ComponentAttribute.ComponentAttribute(Type[], ComponentAttribute.ScopeEnum) Constructor ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) +Sources: di\component\ComponentAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Private constructor used to build the singleton instance +Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container using the specified registerAs types. ```csharp -private Configuration() +public ComponentAttribute(Type[] registerAs, ComponentAttribute.ScopeEnum scope = 0) ``` +Constructor parameters
System.Type[] registerAs
The type to use to register the decorated component.
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) scope
The instance scope
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## Configuration.AddOrUpdateItem(string, object) Method ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## ComponentAttribute.ComponentAttribute(Type[], net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum?, ComponentAttribute.ScopeEnum) Constructor ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) +Sources: di\component\ComponentAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Add a new configuration item with given value or updates its value if the key already exists. +Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container using the specified registerAs types. ```csharp -private void AddOrUpdateItem(string key, object value) +private ComponentAttribute(Type[] registerAs = null, net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum? implicitRegistrationType = 2, ComponentAttribute.ScopeEnum scope = 0) ``` -Method parameters
string key
Configuration item key
object value
The value to be set for the configuration item
-Return value
void
- - -### Exceptions ### -
System.ArgumentException
key is null or empty
- - +Constructor parameters
System.Type[] registerAs
The type to use to register the decorated component.
net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum? implicitRegistrationType
Flag how to do the implicit registration when no types are explicitly defined
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) scope
The instance scope
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## Configuration.Bind(Type, string) Method ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## ContainerBuilderExtensions Class ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Sources: di\component\ContainerBuilderExtensions.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Creates a new object with given type and binds the configuration to its public properties where possible. +Autofac Autofac.ContainerBuilder extensions ```csharp -private static object Bind(Type type, string sectionName = null) +internal static class ContainerBuilderExtensions ``` -Method parameters
System.Type type
Type to bind the configuration to
string sectionName
Optional section to bind
-Return value
object
The instance of type bound to the configuration
+Inheritance: object -### Remarks ### -This method doesn't use the binding cache +### Methods ### -### Exceptions ### -
System.ArgumentNullException
type is null
+ | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [AddServicesWithComponentAttribute(ContainerBuilder, Assembly[])](#m-net.adamec.lib.common.di.component.containerbuilderextensions.addserviceswithcomponentattribute_autofac.containerbuilder-system.reflection.assembly_____5belzz) | public static | Adds classes from the assemblies having the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) into Autofac container builder | + | [AddServicesWithComponentAttribute(ContainerBuilder, Type[])](#m-net.adamec.lib.common.di.component.containerbuilderextensions.addserviceswithcomponentattribute_autofac.containerbuilder-system.type_____zsnrga) | public static | Adds classes from array of types having the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) into Autofac container builder | + | [GetImplementedInterfaces(Type)](#m-net.adamec.lib.common.di.component.containerbuilderextensions.getimplementedinterfaces_system.type___vb1m0d) | private static | Gets the array of interfaces implemented by given type except the System.IDisposable interface | + | [Register<TLimit,TActivatorData,TRegistrationStyle>(IRegistrationBuilder<TLimit,TActivatorData,TRegistrationStyle>, Type, ComponentAttribute)](#m-net.adamec.lib.common.di.component.containerbuilderextensions.register--3_autofac.builder.iregistrationbuilder_--0---1---2_-system.type-net.adamec.lib.common.di.component.componentattribute___9sj1q8) | private static | Registers the type with componentAttribute using the Autofac container builder | + + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -1131,25 +1051,28 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## Configuration.Bind<TOptionsContainer>(string, bool) Method ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## ContainerBuilderExtensions.AddServicesWithComponentAttribute(ContainerBuilder, Assembly[]) Method ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.component.containerbuilderextensions__lgbl4y) +Sources: di\component\ContainerBuilderExtensions.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Binds the configuration to given TOptionsContainer type and returns the bound object of such type. The resulting configuration object is stored to the cache and can be later on retrieved using [Retrieve<TOptionsContainer>()](#m-net.adamec.lib.common.config.configuration.retrieve--1__1xuxip8) +Adds classes from the assemblies having the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) into Autofac container builder ```csharp -public static Configuration.TOptionsContainer Bind(string sectionName = null, bool allowCached = true) where TOptionsContainer: new() +public static void AddServicesWithComponentAttribute(this ContainerBuilder builder, params Assembly[] assemblies) ``` -Type parameters
TOptionsContainer
Type to bind the configuration to
-Method parameters
string sectionName
Optional section to bind
bool allowCached
True if the cache of bindings can be used to retrieve existing binding with the same TOptionsContainer and sectionName
-Return value
net.adamec.lib.common.config.Configuration.TOptionsContainer
The instance of TOptionsContainer bound to the configuration
+Method parameters
Autofac.ContainerBuilder builder
Autofac container builder
System.Reflection.Assembly[] assemblies
Assemblies to check the classes for the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl)
+Return value
void
+ + +### Exceptions ### +
System.ArgumentNullException
builder or assemblies is null
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -1158,23 +1081,28 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## Configuration.Builder() Method ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## ContainerBuilderExtensions.AddServicesWithComponentAttribute(ContainerBuilder, Type[]) Method ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.component.containerbuilderextensions__lgbl4y) +Sources: di\component\ContainerBuilderExtensions.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Clears the configuration items and binding cache and creates a new instance of [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj) +Adds classes from array of types having the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) into Autofac container builder ```csharp -public static Configuration.ConfigurationBuilder Builder() +public static void AddServicesWithComponentAttribute(this ContainerBuilder builder, params Type[] types) ``` -Return value
[net.adamec.lib.common.config.Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj)
The instance of [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj)
+Method parameters
Autofac.ContainerBuilder builder
Autofac container builder
System.Type[] types
Array of types to check the classes for the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl)
+Return value
void
+ + +### Exceptions ### +
System.ArgumentNullException
builder or types is null
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -1183,24 +1111,32 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## Configuration.Get(string) Method ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## ContainerBuilderExtensions.GetImplementedInterfaces(Type) Method ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.component.containerbuilderextensions__lgbl4y) +Sources: di\component\ContainerBuilderExtensions.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Gets the configuration item by key +Gets the array of interfaces implemented by given type except the System.IDisposable interface ```csharp -public static object Get(string key) +private static Type[] GetImplementedInterfaces(Type type) ``` -Method parameters
string key
Key of the configuration item
-Return value
object
Retrieved configuration item value or null if not found (or the configuration item is null itself)
+Method parameters
System.Type type
Type to check
+Return value
System.Type[]
Array of interfaces implemented by given type except the System.IDisposable interface
+ + +### Remarks ### +When the type itself is an interface, it's added to the returned list. + + +### Exceptions ### +
System.ArgumentNullException
type is null
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -1209,25 +1145,29 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## Configuration.Get<TValueType>(string, Configuration.TValueType) Method ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## ContainerBuilderExtensions.Register<TLimit,TActivatorData,TRegistrationStyle>(IRegistrationBuilder<TLimit,TActivatorData,TRegistrationStyle>, Type, ComponentAttribute) Method ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.component.containerbuilderextensions__lgbl4y) +Sources: di\component\ContainerBuilderExtensions.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Gets the typed configuration item by key . Returns the default value, that can be provided or is default to given TValueType The function tries to convert the value to TValueType using System.Convert.ChangeType(System.Object,System.Type) if the conversion is not successful, the default is returned. +Registers the type with componentAttribute using the Autofac container builder ```csharp -public static Configuration.TValueType Get(string key, Configuration.TValueType defaultValue = null) +private static void Register(IRegistrationBuilder builder, Type type, ComponentAttribute componentAttribute) ``` -Type parameters
TValueType
The type the value is to be retrieved in
-Method parameters
string key
Key of the configuration item
net.adamec.lib.common.config.Configuration.TValueType defaultValue
Optional default value to be returned when the value can't be retrieved of converted
-Return value
net.adamec.lib.common.config.Configuration.TValueType
Retrieved configuration item value or defaultValue when it can't be retrieved or converted
+Type parameters
TLimit
Registration limit type.
TActivatorData
Activator data type.
TRegistrationStyle
Registration style.
+Method parameters
Autofac.Builder.IRegistrationBuilder<TLimit,TActivatorData,TRegistrationStyle> builder
Autofac container builder
System.Type type
Type to register
[net.adamec.lib.common.di.component.ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) componentAttribute
[ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) of given type
+Return value
void
+ + +### Exceptions ### +
System.ArgumentNullException
builder , type or componentAttribute is `null`
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -1236,80 +1176,70 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## Configuration.GetSection(string) Method ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## NamedComponentRegistrationAttribute Class ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Sources: di\component\NamedComponentRegistrationAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Gets the configuration sub-tree that belongs to given section. The keys returned are relative to given section! When the section is not provided, the whole configuration tree is returned. +Defines the registration name and type for named registration (component type will be used if null) ```csharp -private static Dictionary GetSection(string sectionName = null) +[AttributeUsage(System.AttributeTargets.Class, AllowMultiple = false)] +public class NamedComponentRegistrationAttribute : Attribute ``` -Method parameters
string sectionName
Optional name of the section.
-Return value
Dictionary<string,object>
The configuration items that belong to the section with sectionName . The keys in returned dictionary are relative to given section!
+Inheritance: object -> Attribute +Attributes: System.AttributeUsageAttribute -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) +### Properties ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [Name](#p-net.adamec.lib.common.di.component.namedcomponentregistrationattribute.name__12kb1kq) | public | Registration name | + | [Type](#p-net.adamec.lib.common.di.component.namedcomponentregistrationattribute.type__1egg26x) | public | Registrations type for named registration. Component type will be used if null | -## Configuration.Retrieve<TOptionsContainer>() Method ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) -Assembly: net.adamec.lib.common -Type: [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +### Constructors ### + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [NamedComponentRegistrationAttribute(string)](#m-net.adamec.lib.common.di.component.namedcomponentregistrationattribute.-ctor_system.string___15ni23w) | public | Named registration with component type used | + | [NamedComponentRegistrationAttribute(string, Type)](#m-net.adamec.lib.common.di.component.namedcomponentregistrationattribute.-ctor_system.string-system.type___1m420ct) | public | Defines the registration name and type for named registration (component type will be used if null) | -Retrieves the configuration object of given TOptionsContainer that has been bound and cached before. The new instance of TOptionsContainer is created when the type not found in cache + - -```csharp -public static Configuration.TOptionsContainer Retrieve() where TOptionsContainer: new() -``` - -Type parameters
TOptionsContainer
Type of the configuration class to retrieve from cache
-Return value
net.adamec.lib.common.config.Configuration.TOptionsContainer
The instance of TOptionsContainer bound to the configuration or a new instance if not found
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) +Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -##
Configuration.TryConvertValue(Type, object, object) Method ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## NamedComponentRegistrationAttribute.Name Property ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [NamedComponentRegistrationAttribute](#t-net.adamec.lib.common.di.component.namedcomponentregistrationattribute__158ujcr) +Sources: di\component\NamedComponentRegistrationAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Tries to convert sourceValue to targetType . The converted values is returned in targetValue out parameter, the result of conversion is the function return value. +Registration name ```csharp -private static bool TryConvertValue(Type targetType, object sourceValue, out object targetValue) +public string Name { get; set; } ``` -Method parameters
System.Type targetType
Target (property) type
object sourceValue
Source value as stored in configuration item
object targetValue
sourceValue converted to targetType when the conversion succeeded (return value is true) or source value otherwise
-Return value
bool
The result or conversion. If true, the targetValue can be set to property having targetType
- - -### Remarks ### -The implementation treats the System.Boolean values the special way - if there is no value, but existing key, the value is converted to true. +Property value
string
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -1318,36 +1248,23 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## Configuration.ConfigurationBuilder Class ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## NamedComponentRegistrationAttribute.Type Property ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [NamedComponentRegistrationAttribute](#t-net.adamec.lib.common.di.component.namedcomponentregistrationattribute__158ujcr) +Sources: di\component\NamedComponentRegistrationAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Configuration builder providing the methods for adding the configuration items from individual sources +Registrations type for named registration. Component type will be used if null ```csharp -public class Configuration.ConfigurationBuilder +public Type Type { get; set; } ``` -Inheritance: object - - - -### Methods ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [Add(string, object)](#m-net.adamec.lib.common.config.configuration.configurationbuilder.add_system.string-system.object___t030mu) | public | Add a new configuration item with given value or updates its value if the key already exists. | - | [AddCommandLineArguments(string[])](#m-net.adamec.lib.common.config.configuration.configurationbuilder.addcommandlinearguments_system.string_____f7vkq1) | public | Adds the command line arguments starting with prefixes into the [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) . When a configuration item exists, the value is updated. | - | [AddEnvironmentVariables()](#m-net.adamec.lib.common.config.configuration.configurationbuilder.addenvironmentvariables__1behrcd) | public | Adds all environment variables into the [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) . When a configuration item exists, the value is updated. | - | [AddJsonFile(string, bool, bool)](#m-net.adamec.lib.common.config.configuration.configurationbuilder.addjsonfile_system.string-system.boolean-system.boolean___fpcrpi) | public | Loads the configuration items from JSON file, keeping the hierarchy of JSON objects (and arrays) When a configuration item exists, the value is updated. | - | [Build()](#m-net.adamec.lib.common.config.configuration.configurationbuilder.build__bwvls6) | public | Finishes the configuration building and returns the [Instance](#p-net.adamec.lib.common.config.configuration.instance__131avv7) | - - +Property value
System.Type
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -1356,60 +1273,48 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## Configuration.ConfigurationBuilder.Add(string, object) Method ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## NamedComponentRegistrationAttribute.NamedComponentRegistrationAttribute(string) Constructor ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [NamedComponentRegistrationAttribute](#t-net.adamec.lib.common.di.component.namedcomponentregistrationattribute__158ujcr) +Sources: di\component\NamedComponentRegistrationAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Add a new configuration item with given value or updates its value if the key already exists. +Named registration with component type used ```csharp -public Configuration.ConfigurationBuilder Add(string key, object value) +public NamedComponentRegistrationAttribute(string name) ``` -Method parameters
string key
Configuration item key
object value
The value to be set for the configuration item
-Return value
[net.adamec.lib.common.config.Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj)
The current [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj)
- - -### Exceptions ### -
System.ArgumentException
key is null or empty
- - +Constructor parameters
string name
Registration name
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## Configuration.ConfigurationBuilder.AddCommandLineArguments(string[]) Method ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## NamedComponentRegistrationAttribute.NamedComponentRegistrationAttribute(string, Type) Constructor ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [NamedComponentRegistrationAttribute](#t-net.adamec.lib.common.di.component.namedcomponentregistrationattribute__158ujcr) +Sources: di\component\NamedComponentRegistrationAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Adds the command line arguments starting with prefixes into the [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) . When a configuration item exists, the value is updated. +Defines the registration name and type for named registration (component type will be used if null) ```csharp -public Configuration.ConfigurationBuilder AddCommandLineArguments(params string[] prefixes) +public NamedComponentRegistrationAttribute(string name, Type type) ``` -Method parameters
string[] prefixes
Optional list of prefixes marking the command line arguments to be the configuration items
-Return value
[net.adamec.lib.common.config.Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj)
The current [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj)
- - -### Remarks ### -The command line arguments have the syntax `key=value` (for example `Key1=Option1` or `prefixkey=value` (for example `-p:Key1=Option1` where `-p:` is the prefix). When the prefixes are not provided, all command line arguments are added to the configuration. When the prefixes are provided,the prefix is not a part of the key. The implementation of binding treats the System.Boolean values the special way - if there is no value, but existing key, the value is converted to true, allowing to use the parameters like flags. For example having the argument `-p:SkipStep1` and prefix `-p:` , the binding a bool property `SkipStep1` will set the value of the property to `true` (doesn't change the configuration item itself). Of course, it's still possible to use the syntax `-p:SkipStep1=true` or `-p:SkipStep1=false` even in this case. - - +Constructor parameters
string name
Registration name
System.Type type
Registrations type for named registration. Component type will be used if null
+### Exceptions ### +
System.ArgumentException
name is null or empty
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -1418,27 +1323,34 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## Configuration.ConfigurationBuilder.AddEnvironmentVariables() Method ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## ComponentAttribute.ImplicitRegistrationTypeEnum Enum ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Sources: di\component\ComponentAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Adds all environment variables into the [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) . When a configuration item exists, the value is updated. +Kind of the implicit component registration ```csharp -public Configuration.ConfigurationBuilder AddEnvironmentVariables() +public enum ComponentAttribute.ImplicitRegistrationTypeEnum: int ``` -Return value
[net.adamec.lib.common.config.Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj)
The current [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj)
+Inheritance:
object -> ValueType -> Enum +Implements: System.IComparable, System.IConvertible, System.IFormattable -### Remarks ### -The name of the environment variable is used as a key to the configuration item. Use the "dot notation" in variable names to support the configuration hierarchy. +### Constants ### + + | Name | Value | Summary | + | ------ | ------- | --------- | + | [Self](#f-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum.self__qkcsxq) | 0 | Register as self (type) only | + | [ImplementedInterfaces](#f-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum.implementedinterfaces__n5lxu0) | 1 | Register as all implemented interfaces | + | [SelfAndImplementedInterfaces](#f-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum.selfandimplementedinterfaces__1135ahd) | 2 | Register as self (type) and all implemented interfaces | + + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -1447,28 +1359,23 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## Configuration.ConfigurationBuilder.AddJsonFile(string, bool, bool) Method ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## ComponentAttribute.ImplicitRegistrationTypeEnum.ImplementedInterfaces Constant ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo) +Sources: di\component\ComponentAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Loads the configuration items from JSON file, keeping the hierarchy of JSON objects (and arrays) When a configuration item exists, the value is updated. +Register as all implemented interfaces ```csharp -public Configuration.ConfigurationBuilder AddJsonFile(string fileName, bool ignoreNullOrEmptyFileName = false, bool ignoreIfNotExist = false) + ImplementedInterfaces = 1 ``` -Method parameters
string fileName
Name of the JSON file with configuration
bool ignoreNullOrEmptyFileName
If true, the missing file name will not throw the exception and the method just "silently" ends.
bool ignoreIfNotExist
If true, the non existing file will not throw the exception and the method just "silently" ends.
-Return value
[net.adamec.lib.common.config.Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj)
The current [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj)
- - -### Exceptions ### -
System.ArgumentException
fileName is null or empty and ignoreNullOrEmptyFileName is false
System.ArgumentException
fileName doesn't exist and ignoreIfNotExist is false
+Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo)
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -1477,23 +1384,23 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## Configuration.ConfigurationBuilder.Build() Method ## -Namespace: [net.adamec.lib.common.config](#n-net.adamec.lib.common.config__1nl4uve) +## ComponentAttribute.ImplicitRegistrationTypeEnum.Self Constant ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj) -Sources: config\Configuration.cs -Source-only packages: [RadCommons.config.Configuration](#src-only-package--RadCommons.config.Configuration) +Type: [ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo) +Sources: di\component\ComponentAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Finishes the configuration building and returns the [Instance](#p-net.adamec.lib.common.config.configuration.instance__131avv7) +Register as self (type) only ```csharp -public Configuration Build() + Self = 0 ``` -Return value
[net.adamec.lib.common.config.Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk)
The [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) singleton
+Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo)
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -1502,26 +1409,23 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -##
net.adamec.lib.common.di.component Namespace ## -### Classes ### +## ComponentAttribute.ImplicitRegistrationTypeEnum.SelfAndImplementedInterfaces Constant ## +Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) +Assembly: net.adamec.lib.common +Type: [ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo) +Sources: di\component\ComponentAttribute.cs +Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) | public | Marks the decorated class as a component that will be available from the service locator / component container. | - | [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.component.containerbuilderextensions__lgbl4y) | internal static | Autofac Autofac.ContainerBuilder extensions | - | [NamedComponentRegistrationAttribute](#t-net.adamec.lib.common.di.component.namedcomponentregistrationattribute__158ujcr) | public | Defines the registration name and type for named registration (component type will be used if null) | - +Register as self (type) and all implemented interfaces -### Enums ### - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo) | public | Kind of the implicit component registration | - | [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) | public | Component scope | +```csharp + SelfAndImplementedInterfaces = 2 +``` - +Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo)
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -1530,46 +1434,36 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -##
ComponentAttribute Class ## +## ComponentAttribute.ScopeEnum Enum ## Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common Sources: di\component\ComponentAttribute.cs Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Marks the decorated class as a component that will be available from the service locator / component container. +Component scope ```csharp -[AttributeUsage(System.AttributeTargets.Class, AllowMultiple = false)] -public class ComponentAttribute : Attribute +public enum ComponentAttribute.ScopeEnum: int ``` -Inheritance: object -> Attribute -Attributes: System.AttributeUsageAttribute - - - -### Properties ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ImplicitRegistrationType](#p-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtype__1mysue9) | public | Flag how to do the implicit registration when no types are explicitly defined | - | [RegisterAs](#p-net.adamec.lib.common.di.component.componentattribute.registeras__1m8nlcq) | public | Type to use for the component registration. | - | [Scope](#p-net.adamec.lib.common.di.component.componentattribute.scope__1h6i43p) | public | Defines the instance scope | - - +Inheritance: object -> ValueType -> Enum +Implements: System.IComparable, System.IConvertible, System.IFormattable -### Constructors ### +### Constants ### - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ComponentAttribute(ComponentAttribute.ImplicitRegistrationTypeEnum, ComponentAttribute.ScopeEnum)](#m-net.adamec.lib.common.di.component.componentattribute.-ctor_net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum-net.adamec.lib.common.di.component.componentattribute.scopeenum___ex53ua) | public | Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container, registered as the concrete type or with all implemented interfaces as well if specified. | - | [ComponentAttribute(Type, ComponentAttribute.ScopeEnum)](#m-net.adamec.lib.common.di.component.componentattribute.-ctor_system.type-net.adamec.lib.common.di.component.componentattribute.scopeenum___1ubqgal) | public | Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container using the specified registerAs type. | - | [ComponentAttribute(Type[], ComponentAttribute.ScopeEnum)](#m-net.adamec.lib.common.di.component.componentattribute.-ctor_system.type__-net.adamec.lib.common.di.component.componentattribute.scopeenum___1rdjiuf) | public | Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container using the specified registerAs types. | - | [ComponentAttribute(Type[], net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum?, ComponentAttribute.ScopeEnum)](#m-net.adamec.lib.common.di.component.componentattribute.-ctor_system.type__-system.nullable_net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum_-net.adamec.lib.common.di.component.componentattribute.scopeenum___1h4ujev) | private | Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container using the specified registerAs types. | + | Name | Value | Summary | + | ------ | ------- | --------- | + | [InstancePerDependency](#f-net.adamec.lib.common.di.component.componentattribute.scopeenum.instanceperdependency__1efcen7) | 0 | Transient scope (instance per dependency) | + | [Transient](#f-net.adamec.lib.common.di.component.componentattribute.scopeenum.transient__1f6925u) | 0 | Transient scope (instance per dependency) | + | [SingleInstance](#f-net.adamec.lib.common.di.component.componentattribute.scopeenum.singleinstance__st19r1) | 1 | Singleton | + | [Singleton](#f-net.adamec.lib.common.di.component.componentattribute.scopeenum.singleton__1p12io5) | 1 | Singleton | + | [InstancePerLifetimeScope](#f-net.adamec.lib.common.di.component.componentattribute.scopeenum.instanceperlifetimescope__17fxlux) | 2 | Instance per lifetime scope | + | [InstancePerRequest](#f-net.adamec.lib.common.di.component.componentattribute.scopeenum.instanceperrequest__12s64w1) | 3 | Instance per request (scoped) | + | [Scoped](#f-net.adamec.lib.common.di.component.componentattribute.scopeenum.scoped__1356nu4) | 3 | Instance per request (scoped) | @@ -1580,23 +1474,23 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ComponentAttribute.ImplicitRegistrationType Property ## +## ComponentAttribute.ScopeEnum.InstancePerDependency Constant ## Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) +Type: [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) Sources: di\component\ComponentAttribute.cs Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Flag how to do the implicit registration when no types are explicitly defined +Transient scope (instance per dependency) ```csharp -public net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum? ImplicitRegistrationType { get; } + InstancePerDependency = 0 ``` -Property value
net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum?
+Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -1605,23 +1499,23 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ComponentAttribute.RegisterAs Property ## +## ComponentAttribute.ScopeEnum.InstancePerLifetimeScope Constant ## Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) +Type: [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) Sources: di\component\ComponentAttribute.cs Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Type to use for the component registration. +Instance per lifetime scope ```csharp -public Type[] RegisterAs { get; } + InstancePerLifetimeScope = 2 ``` -Property value
System.Type[]
+Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -1630,23 +1524,23 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ComponentAttribute.Scope Property ## +## ComponentAttribute.ScopeEnum.InstancePerRequest Constant ## Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) +Type: [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) Sources: di\component\ComponentAttribute.cs Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Defines the instance scope +Instance per request (scoped) ```csharp -public ComponentAttribute.ScopeEnum Scope { get; } + InstancePerRequest = 3 ``` -Property value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
+Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -1655,274 +1549,136 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -##
ComponentAttribute.ComponentAttribute(ComponentAttribute.ImplicitRegistrationTypeEnum, ComponentAttribute.ScopeEnum) Constructor ## +## ComponentAttribute.ScopeEnum.Scoped Constant ## Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) +Type: [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) Sources: di\component\ComponentAttribute.cs Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container, registered as the concrete type or with all implemented interfaces as well if specified. +Instance per request (scoped) ```csharp -public ComponentAttribute(ComponentAttribute.ImplicitRegistrationTypeEnum implicitRegistrationType = 0, ComponentAttribute.ScopeEnum scope = 0) + Scoped = 3 ``` -Constructor parameters
[net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo) implicitRegistrationType
Flag how to do the implicit registration when no types are explicitly defined
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) scope
The instance scope
+Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
+ + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -##
ComponentAttribute.ComponentAttribute(Type, ComponentAttribute.ScopeEnum) Constructor ## +## ComponentAttribute.ScopeEnum.SingleInstance Constant ## Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) +Type: [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) Sources: di\component\ComponentAttribute.cs Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container using the specified registerAs type. +Singleton ```csharp -public ComponentAttribute(Type registerAs, ComponentAttribute.ScopeEnum scope = 0) + SingleInstance = 1 ``` -Constructor parameters
System.Type registerAs
The type to use to register the decorated component.
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) scope
The instance scope
+Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
+ + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## ComponentAttribute.ComponentAttribute(Type[], ComponentAttribute.ScopeEnum) Constructor ## +## ComponentAttribute.ScopeEnum.Singleton Constant ## Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) +Type: [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) Sources: di\component\ComponentAttribute.cs Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container using the specified registerAs types. +Singleton ```csharp -public ComponentAttribute(Type[] registerAs, ComponentAttribute.ScopeEnum scope = 0) + Singleton = 1 ``` -Constructor parameters
System.Type[] registerAs
The type to use to register the decorated component.
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) scope
The instance scope
+Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
+ + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## ComponentAttribute.ComponentAttribute(Type[], net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum?, ComponentAttribute.ScopeEnum) Constructor ## +## ComponentAttribute.ScopeEnum.Transient Constant ## Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) Assembly: net.adamec.lib.common -Type: [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) +Type: [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) Sources: di\component\ComponentAttribute.cs Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) -Initializes a new instance of the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) class, marking the decorated class as a component that will be available from the component container using the specified registerAs types. +Transient scope (instance per dependency) ```csharp -private ComponentAttribute(Type[] registerAs = null, net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum? implicitRegistrationType = 2, ComponentAttribute.ScopeEnum scope = 0) + Transient = 0 ``` -Constructor parameters
System.Type[] registerAs
The type to use to register the decorated component.
net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum? implicitRegistrationType
Flag how to do the implicit registration when no types are explicitly defined
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) scope
The instance scope
+Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
+ + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## ContainerBuilderExtensions Class ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Sources: di\component\ContainerBuilderExtensions.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) +## net.adamec.lib.common.di.config Namespace ## +### Classes ### + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) | public | Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI | -Autofac Autofac.ContainerBuilder extensions + - -```csharp -internal static class ContainerBuilderExtensions -``` - -Inheritance: object - - - -### Methods ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [AddServicesWithComponentAttribute(ContainerBuilder, Assembly[])](#m-net.adamec.lib.common.di.component.containerbuilderextensions.addserviceswithcomponentattribute_autofac.containerbuilder-system.reflection.assembly_____5belzz) | public static | Adds classes from the assemblies having the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) into Autofac container builder | - | [AddServicesWithComponentAttribute(ContainerBuilder, Type[])](#m-net.adamec.lib.common.di.component.containerbuilderextensions.addserviceswithcomponentattribute_autofac.containerbuilder-system.type_____zsnrga) | public static | Adds classes from array of types having the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) into Autofac container builder | - | [GetImplementedInterfaces(Type)](#m-net.adamec.lib.common.di.component.containerbuilderextensions.getimplementedinterfaces_system.type___vb1m0d) | private static | Gets the array of interfaces implemented by given type except the System.IDisposable interface | - | [Register<TLimit,TActivatorData,TRegistrationStyle>(IRegistrationBuilder<TLimit,TActivatorData,TRegistrationStyle>, Type, ComponentAttribute)](#m-net.adamec.lib.common.di.component.containerbuilderextensions.register--3_autofac.builder.iregistrationbuilder_--0---1---2_-system.type-net.adamec.lib.common.di.component.componentattribute___9sj1q8) | private static | Registers the type with componentAttribute using the Autofac container builder | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ContainerBuilderExtensions.AddServicesWithComponentAttribute(ContainerBuilder, Assembly[]) Method ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.component.containerbuilderextensions__lgbl4y) -Sources: di\component\ContainerBuilderExtensions.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Adds classes from the assemblies having the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) into Autofac container builder - - - -```csharp -public static void AddServicesWithComponentAttribute(this ContainerBuilder builder, params Assembly[] assemblies) -``` - -Method parameters
Autofac.ContainerBuilder builder
Autofac container builder
System.Reflection.Assembly[] assemblies
Assemblies to check the classes for the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl)
-Return value
void
- - -### Exceptions ### -
System.ArgumentNullException
builder or assemblies is null
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ContainerBuilderExtensions.AddServicesWithComponentAttribute(ContainerBuilder, Type[]) Method ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.component.containerbuilderextensions__lgbl4y) -Sources: di\component\ContainerBuilderExtensions.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Adds classes from array of types having the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) into Autofac container builder - - - -```csharp -public static void AddServicesWithComponentAttribute(this ContainerBuilder builder, params Type[] types) -``` - -Method parameters
Autofac.ContainerBuilder builder
Autofac container builder
System.Type[] types
Array of types to check the classes for the [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl)
-Return value
void
- - -### Exceptions ### -
System.ArgumentNullException
builder or types is null
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ContainerBuilderExtensions.GetImplementedInterfaces(Type) Method ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.component.containerbuilderextensions__lgbl4y) -Sources: di\component\ContainerBuilderExtensions.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Gets the array of interfaces implemented by given type except the System.IDisposable interface - - - -```csharp -private static Type[] GetImplementedInterfaces(Type type) -``` - -Method parameters
System.Type type
Type to check
-Return value
System.Type[]
Array of interfaces implemented by given type except the System.IDisposable interface
- - -### Remarks ### -When the type itself is an interface, it's added to the returned list. - - -### Exceptions ### -
System.ArgumentNullException
type is null
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ContainerBuilderExtensions.Register<TLimit,TActivatorData,TRegistrationStyle>(IRegistrationBuilder<TLimit,TActivatorData,TRegistrationStyle>, Type, ComponentAttribute) Method ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.component.containerbuilderextensions__lgbl4y) -Sources: di\component\ContainerBuilderExtensions.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Registers the type with componentAttribute using the Autofac container builder - - - -```csharp -private static void Register(IRegistrationBuilder builder, Type type, ComponentAttribute componentAttribute) -``` - -Type parameters
TLimit
Registration limit type.
TActivatorData
Activator data type.
TRegistrationStyle
Registration style.
-Method parameters
Autofac.Builder.IRegistrationBuilder<TLimit,TActivatorData,TRegistrationStyle> builder
Autofac container builder
System.Type type
Type to register
[net.adamec.lib.common.di.component.ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) componentAttribute
[ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) of given type
-Return value
void
- - -### Exceptions ### -
System.ArgumentNullException
builder , type or componentAttribute is `null`
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) +Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## NamedComponentRegistrationAttribute Class ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) +## AutoOptionsAttribute Class ## +Namespace: [net.adamec.lib.common.di.config](#n-net.adamec.lib.common.di.config__3709lb) Assembly: net.adamec.lib.common -Sources: di\component\NamedComponentRegistrationAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) +Sources: di\config\AutoOptionsAttribute.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Defines the registration name and type for named registration (component type will be used if null) +Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI ```csharp [AttributeUsage(System.AttributeTargets.Class, AllowMultiple = false)] -public class NamedComponentRegistrationAttribute : Attribute +public class AutoOptionsAttribute : Attribute ``` Inheritance: object -> Attribute @@ -1934,8 +1690,8 @@ Attributes: NamedComponentRegistrationAttribute.Name Property ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) +## AutoOptionsAttribute.ConfigSection Property ## +Namespace: [net.adamec.lib.common.di.config](#n-net.adamec.lib.common.di.config__3709lb) Assembly: net.adamec.lib.common -Type: [NamedComponentRegistrationAttribute](#t-net.adamec.lib.common.di.component.namedcomponentregistrationattribute__158ujcr) -Sources: di\component\NamedComponentRegistrationAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) +Type: [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) +Sources: di\config\AutoOptionsAttribute.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Registration name +Path to the section within appsettings.json ```csharp -public string Name { get; set; } +public string ConfigSection { get; } ``` Property value
string
@@ -1981,3059 +1736,67 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## NamedComponentRegistrationAttribute.Type Property ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) +## AutoOptionsAttribute.RegisterDirect Property ## +Namespace: [net.adamec.lib.common.di.config](#n-net.adamec.lib.common.di.config__3709lb) Assembly: net.adamec.lib.common -Type: [NamedComponentRegistrationAttribute](#t-net.adamec.lib.common.di.component.namedcomponentregistrationattribute__158ujcr) -Sources: di\component\NamedComponentRegistrationAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) +Type: [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) +Sources: di\config\AutoOptionsAttribute.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Registrations type for named registration. Component type will be used if null +Flag whether to create and registers the options class instance into MS DI ```csharp -public Type Type { get; set; } +public bool RegisterDirect { get; } ``` -Property value
System.Type
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## NamedComponentRegistrationAttribute.NamedComponentRegistrationAttribute(string) Constructor ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Type: [NamedComponentRegistrationAttribute](#t-net.adamec.lib.common.di.component.namedcomponentregistrationattribute__158ujcr) -Sources: di\component\NamedComponentRegistrationAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Named registration with component type used - - +Property value
bool
-```csharp -public NamedComponentRegistrationAttribute(string name) -``` -Constructor parameters
string name
Registration name
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## NamedComponentRegistrationAttribute.NamedComponentRegistrationAttribute(string, Type) Constructor ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) +## AutoOptionsAttribute.AutoOptionsAttribute(string, bool) Constructor ## +Namespace: [net.adamec.lib.common.di.config](#n-net.adamec.lib.common.di.config__3709lb) Assembly: net.adamec.lib.common -Type: [NamedComponentRegistrationAttribute](#t-net.adamec.lib.common.di.component.namedcomponentregistrationattribute__158ujcr) -Sources: di\component\NamedComponentRegistrationAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) +Type: [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) +Sources: di\config\AutoOptionsAttribute.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Defines the registration name and type for named registration (component type will be used if null) +Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI ```csharp -public NamedComponentRegistrationAttribute(string name, Type type) +public AutoOptionsAttribute(string configSection, bool registerDirect = false) ``` -Constructor parameters
string name
Registration name
System.Type type
Registrations type for named registration. Component type will be used if null
+Constructor parameters
string configSection
bool registerDirect
### Exceptions ### -
System.ArgumentException
name is null or empty
+
System.ArgumentNullException
configSection is `null`
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - -## ComponentAttribute.ImplicitRegistrationTypeEnum Enum ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Sources: di\component\ComponentAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Kind of the implicit component registration - - - -```csharp -public enum ComponentAttribute.ImplicitRegistrationTypeEnum: int -``` - -Inheritance: object -> ValueType -> Enum -Implements: System.IComparable, System.IConvertible, System.IFormattable - - -### Constants ### - - | Name | Value | Summary | - | ------ | ------- | --------- | - | [Self](#f-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum.self__qkcsxq) | 0 | Register as self (type) only | - | [ImplementedInterfaces](#f-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum.implementedinterfaces__n5lxu0) | 1 | Register as all implemented interfaces | - | [SelfAndImplementedInterfaces](#f-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum.selfandimplementedinterfaces__1135ahd) | 2 | Register as self (type) and all implemented interfaces | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ComponentAttribute.ImplicitRegistrationTypeEnum.ImplementedInterfaces Constant ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Type: [ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo) -Sources: di\component\ComponentAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Register as all implemented interfaces - - - -```csharp - ImplementedInterfaces = 1 -``` - -Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo)
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -##
ComponentAttribute.ImplicitRegistrationTypeEnum.Self Constant ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Type: [ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo) -Sources: di\component\ComponentAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Register as self (type) only - - - -```csharp - Self = 0 -``` - -Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo)
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -##
ComponentAttribute.ImplicitRegistrationTypeEnum.SelfAndImplementedInterfaces Constant ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Type: [ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo) -Sources: di\component\ComponentAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Register as self (type) and all implemented interfaces - - - -```csharp - SelfAndImplementedInterfaces = 2 -``` - -Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ImplicitRegistrationTypeEnum](#t-net.adamec.lib.common.di.component.componentattribute.implicitregistrationtypeenum__10jaypo)
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -##
ComponentAttribute.ScopeEnum Enum ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Sources: di\component\ComponentAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Component scope - - - -```csharp -public enum ComponentAttribute.ScopeEnum: int -``` - -Inheritance: object -> ValueType -> Enum -Implements: System.IComparable, System.IConvertible, System.IFormattable - - -### Constants ### - - | Name | Value | Summary | - | ------ | ------- | --------- | - | [InstancePerDependency](#f-net.adamec.lib.common.di.component.componentattribute.scopeenum.instanceperdependency__1efcen7) | 0 | Transient scope (instance per dependency) | - | [Transient](#f-net.adamec.lib.common.di.component.componentattribute.scopeenum.transient__1f6925u) | 0 | Transient scope (instance per dependency) | - | [SingleInstance](#f-net.adamec.lib.common.di.component.componentattribute.scopeenum.singleinstance__st19r1) | 1 | Singleton | - | [Singleton](#f-net.adamec.lib.common.di.component.componentattribute.scopeenum.singleton__1p12io5) | 1 | Singleton | - | [InstancePerLifetimeScope](#f-net.adamec.lib.common.di.component.componentattribute.scopeenum.instanceperlifetimescope__17fxlux) | 2 | Instance per lifetime scope | - | [InstancePerRequest](#f-net.adamec.lib.common.di.component.componentattribute.scopeenum.instanceperrequest__12s64w1) | 3 | Instance per request (scoped) | - | [Scoped](#f-net.adamec.lib.common.di.component.componentattribute.scopeenum.scoped__1356nu4) | 3 | Instance per request (scoped) | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ComponentAttribute.ScopeEnum.InstancePerDependency Constant ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Type: [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) -Sources: di\component\ComponentAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Transient scope (instance per dependency) - - - -```csharp - InstancePerDependency = 0 -``` - -Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -##
ComponentAttribute.ScopeEnum.InstancePerLifetimeScope Constant ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Type: [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) -Sources: di\component\ComponentAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Instance per lifetime scope - - - -```csharp - InstancePerLifetimeScope = 2 -``` - -Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -##
ComponentAttribute.ScopeEnum.InstancePerRequest Constant ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Type: [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) -Sources: di\component\ComponentAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Instance per request (scoped) - - - -```csharp - InstancePerRequest = 3 -``` - -Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -##
ComponentAttribute.ScopeEnum.Scoped Constant ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Type: [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) -Sources: di\component\ComponentAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Instance per request (scoped) - - - -```csharp - Scoped = 3 -``` - -Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -##
ComponentAttribute.ScopeEnum.SingleInstance Constant ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Type: [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) -Sources: di\component\ComponentAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Singleton - - - -```csharp - SingleInstance = 1 -``` - -Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -##
ComponentAttribute.ScopeEnum.Singleton Constant ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Type: [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) -Sources: di\component\ComponentAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Singleton - - - -```csharp - Singleton = 1 -``` - -Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -##
ComponentAttribute.ScopeEnum.Transient Constant ## -Namespace: [net.adamec.lib.common.di.component](#n-net.adamec.lib.common.di.component__9w6ndu) -Assembly: net.adamec.lib.common -Type: [ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps) -Sources: di\component\ComponentAttribute.cs -Source-only packages: [RadCommons.di.Component](#src-only-package--RadCommons.di.Component) - - -Transient scope (instance per dependency) - - - -```csharp - Transient = 0 -``` - -Field value
[net.adamec.lib.common.di.component.ComponentAttribute.ScopeEnum](#t-net.adamec.lib.common.di.component.componentattribute.scopeenum__r7ahps)
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -##
net.adamec.lib.common.di.config Namespace ## -### Classes ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) | public | Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## AutoOptionsAttribute Class ## -Namespace: [net.adamec.lib.common.di.config](#n-net.adamec.lib.common.di.config__3709lb) -Assembly: net.adamec.lib.common -Sources: di\config\AutoOptionsAttribute.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI - - - -```csharp -[AttributeUsage(System.AttributeTargets.Class, AllowMultiple = false)] -public class AutoOptionsAttribute : Attribute -``` - -Inheritance: object -> Attribute -Attributes: System.AttributeUsageAttribute - - - -### Properties ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ConfigSection](#p-net.adamec.lib.common.di.config.autooptionsattribute.configsection__zo6f6l) | public | Path to the section within appsettings.json | - | [RegisterDirect](#p-net.adamec.lib.common.di.config.autooptionsattribute.registerdirect__1s9s1yk) | public | Flag whether to create and registers the options class instance into MS DI | - - - - -### Constructors ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [AutoOptionsAttribute(string, bool)](#m-net.adamec.lib.common.di.config.autooptionsattribute.-ctor_system.string-system.boolean___1nw898o) | public | Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## AutoOptionsAttribute.ConfigSection Property ## -Namespace: [net.adamec.lib.common.di.config](#n-net.adamec.lib.common.di.config__3709lb) -Assembly: net.adamec.lib.common -Type: [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) -Sources: di\config\AutoOptionsAttribute.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Path to the section within appsettings.json - - - -```csharp -public string ConfigSection { get; } -``` - -Property value
string
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## AutoOptionsAttribute.RegisterDirect Property ## -Namespace: [net.adamec.lib.common.di.config](#n-net.adamec.lib.common.di.config__3709lb) -Assembly: net.adamec.lib.common -Type: [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) -Sources: di\config\AutoOptionsAttribute.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Flag whether to create and registers the options class instance into MS DI - - - -```csharp -public bool RegisterDirect { get; } -``` - -Property value
bool
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## AutoOptionsAttribute.AutoOptionsAttribute(string, bool) Constructor ## -Namespace: [net.adamec.lib.common.di.config](#n-net.adamec.lib.common.di.config__3709lb) -Assembly: net.adamec.lib.common -Type: [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) -Sources: di\config\AutoOptionsAttribute.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI - - - -```csharp -public AutoOptionsAttribute(string configSection, bool registerDirect = false) -``` - -Constructor parameters
string configSection
bool registerDirect
-### Exceptions ### -
System.ArgumentNullException
configSection is `null`
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## net.adamec.lib.common.di.config.exception Namespace ## -### Classes ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) | public | Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionAutoOptionsExtension | - | [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) | public | Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionConfigureDirectExtensions | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionAutoOptionsException Class ## -Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) -Assembly: net.adamec.lib.common -Sources: di\config\exception\ServiceCollectionAutoOptionsException.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionAutoOptionsExtension - - - -```csharp -public class ServiceCollectionAutoOptionsException : Exception -``` - -Inheritance: object -> System.Exception -Implements: System.Runtime.Serialization.ISerializable - - -### Constructors ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ServiceCollectionAutoOptionsException()](#m-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception.-ctor__o6ojyb) | public | Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) | - | [ServiceCollectionAutoOptionsException(string)](#m-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception.-ctor_system.string___1kcodie) | public | Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) | - | [ServiceCollectionAutoOptionsException(string, Exception)](#m-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception.-ctor_system.string-system.exception___r0rfi6) | public | Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionAutoOptionsException.ServiceCollectionAutoOptionsException() Constructor ## -Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) -Assembly: net.adamec.lib.common -Type: [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) -Sources: di\config\exception\ServiceCollectionAutoOptionsException.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) - - - -```csharp -public ServiceCollectionAutoOptionsException() -``` - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionAutoOptionsException.ServiceCollectionAutoOptionsException(string) Constructor ## -Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) -Assembly: net.adamec.lib.common -Type: [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) -Sources: di\config\exception\ServiceCollectionAutoOptionsException.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) - - - -```csharp -public ServiceCollectionAutoOptionsException(string message) -``` - -Constructor parameters
string message
Error message
-Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionAutoOptionsException.ServiceCollectionAutoOptionsException(string, Exception) Constructor ## -Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) -Assembly: net.adamec.lib.common -Type: [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) -Sources: di\config\exception\ServiceCollectionAutoOptionsException.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) - - - -```csharp -public ServiceCollectionAutoOptionsException(string message, Exception inner) -``` - -Constructor parameters
string message
Error message
System.Exception inner
Inner exception
-Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionConfigureDirectException Class ## -Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) -Assembly: net.adamec.lib.common -Sources: di\config\exception\ServiceCollectionConfigureDirectException.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionConfigureDirectExtensions - - - -```csharp -public class ServiceCollectionConfigureDirectException : Exception -``` - -Inheritance: object -> System.Exception -Implements: System.Runtime.Serialization.ISerializable - - -### Constructors ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ServiceCollectionConfigureDirectException()](#m-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception.-ctor__1n8hr1d) | public | Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) | - | [ServiceCollectionConfigureDirectException(string)](#m-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception.-ctor_system.string___1dp1v34) | public | Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) | - | [ServiceCollectionConfigureDirectException(string, Exception)](#m-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception.-ctor_system.string-system.exception___1uv85c8) | public | Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionConfigureDirectException.ServiceCollectionConfigureDirectException() Constructor ## -Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) -Assembly: net.adamec.lib.common -Type: [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) -Sources: di\config\exception\ServiceCollectionConfigureDirectException.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) - - - -```csharp -public ServiceCollectionConfigureDirectException() -``` - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionConfigureDirectException.ServiceCollectionConfigureDirectException(string) Constructor ## -Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) -Assembly: net.adamec.lib.common -Type: [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) -Sources: di\config\exception\ServiceCollectionConfigureDirectException.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) - - - -```csharp -public ServiceCollectionConfigureDirectException(string message) -``` - -Constructor parameters
string message
Error message
-Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionConfigureDirectException.ServiceCollectionConfigureDirectException(string, Exception) Constructor ## -Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) -Assembly: net.adamec.lib.common -Type: [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) -Sources: di\config\exception\ServiceCollectionConfigureDirectException.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) - - - -```csharp -public ServiceCollectionConfigureDirectException(string message, Exception inner) -``` - -Constructor parameters
string message
Error message
System.Exception inner
Inner exception
-Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## net.adamec.lib.common.di.config.extensions Namespace ## -### Classes ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.config.extensions.containerbuilderextensions__tpisv7) | internal static | Autofac Autofac.ContainerBuilder extensions | - | [ServiceCollectionAutoOptionsExtension](#t-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension__1p9fgao) | internal static | Extensions for options (configuration) class automatic binding to appsettings.json | - | [ServiceCollectionConfigureDirectExtensions](#t-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions__wdwckv) | internal static | Extensions for options (configuration) class registration into MS DI | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ContainerBuilderExtensions Class ## -Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) -Assembly: net.adamec.lib.common -Sources: di\config\extensions\ContainerBuilderExtensions.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Autofac Autofac.ContainerBuilder extensions - - - -```csharp -internal static class ContainerBuilderExtensions -``` - -Inheritance: object - - - -### Methods ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [AddAutoOptions(ContainerBuilder, IConfigurationRoot, Assembly[])](#m-net.adamec.lib.common.di.config.extensions.containerbuilderextensions.addautooptions_autofac.containerbuilder-microsoft.extensions.configuration.iconfigurationroot-system.reflection.assembly_____pfqod1) | public static | Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions | - | [AddAutoOptions(ContainerBuilder, IConfigurationRoot, Type[])](#m-net.adamec.lib.common.di.config.extensions.containerbuilderextensions.addautooptions_autofac.containerbuilder-microsoft.extensions.configuration.iconfigurationroot-system.type_____1fbl63e) | public static | Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions | - | [AddOptions<TOptions>(ContainerBuilder, IConfigurationRoot, string)](#m-net.adamec.lib.common.di.config.extensions.containerbuilderextensions.addoptions--1_autofac.containerbuilder-microsoft.extensions.configuration.iconfigurationroot-system.string___1b2rpkf) | public static | Creates and registers the singleton of configuration (options) class of given type This is to be used if not registered using the [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ContainerBuilderExtensions.AddAutoOptions(ContainerBuilder, IConfigurationRoot, Assembly[]) Method ## -Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) -Assembly: net.adamec.lib.common -Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.config.extensions.containerbuilderextensions__tpisv7) -Sources: di\config\extensions\ContainerBuilderExtensions.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions - - - -```csharp -public static void AddAutoOptions(this ContainerBuilder builder, IConfigurationRoot configuration, params Assembly[] assemblies) -``` - -Method parameters
Autofac.ContainerBuilder builder
AutoFac container builder
Microsoft.Extensions.Configuration.IConfigurationRoot configuration
Configuration container
System.Reflection.Assembly[] assemblies
Assemblies to check
-Return value
void
- - -### Exceptions ### -
System.ArgumentNullException
configuration or assemblies is null
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ContainerBuilderExtensions.AddAutoOptions(ContainerBuilder, IConfigurationRoot, Type[]) Method ## -Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) -Assembly: net.adamec.lib.common -Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.config.extensions.containerbuilderextensions__tpisv7) -Sources: di\config\extensions\ContainerBuilderExtensions.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions - - - -```csharp -public static void AddAutoOptions(this ContainerBuilder builder, IConfigurationRoot configuration, params Type[] types) -``` - -Method parameters
Autofac.ContainerBuilder builder
AutoFac container builder
Microsoft.Extensions.Configuration.IConfigurationRoot configuration
Configuration container
System.Type[] types
Types to check
-Return value
void
- - -### Exceptions ### -
System.ArgumentNullException
configuration or types is null
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ContainerBuilderExtensions.AddOptions<TOptions>(ContainerBuilder, IConfigurationRoot, string) Method ## -Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) -Assembly: net.adamec.lib.common -Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.config.extensions.containerbuilderextensions__tpisv7) -Sources: di\config\extensions\ContainerBuilderExtensions.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Creates and registers the singleton of configuration (options) class of given type This is to be used if not registered using the [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) - - - -```csharp -public static void AddOptions(this ContainerBuilder builder, IConfigurationRoot configuration, string configSection) where TOptions: new() -``` - -Type parameters
TOptions
Configuration class type
-Method parameters
Autofac.ContainerBuilder builder
AutoFac container builder
Microsoft.Extensions.Configuration.IConfigurationRoot configuration
Configuration container
string configSection
Name of the configuration section to bind to
-Return value
void
- - -### Exceptions ### -
System.ArgumentNullException
configuration is null
System.ArgumentException
configSection is null or empty
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionAutoOptionsExtension Class ## -Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) -Assembly: net.adamec.lib.common -Sources: di\config\extensions\ServiceCollectionAutoOptionsExtension.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Extensions for options (configuration) class automatic binding to appsettings.json - - - -```csharp -internal static class ServiceCollectionAutoOptionsExtension -``` - -Inheritance: object - - - -### Fields ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [Logger](#f-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension.logger__1gx9pyg) | private static | | - - - - -### Methods ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ConfigureAutoOptions(IServiceCollection, IConfiguration, Assembly[])](#m-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension.configureautooptions_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration-system.reflection.assembly_____bfjrc2) | public static | Scans given assemblies for classes marked with [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI | - | [ConfigureAutoOptions(IServiceCollection, IConfigurationRoot, Assembly[])](#m-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension.configureautooptions_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfigurationroot-system.reflection.assembly_____1kc5g1y) | public static | Scans given assemblies for classes marked with [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionAutoOptionsExtension.Logger Field ## -Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) -Assembly: net.adamec.lib.common -Type: [ServiceCollectionAutoOptionsExtension](#t-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension__1p9fgao) -Sources: di\config\extensions\ServiceCollectionAutoOptionsExtension.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - - -```csharp -private static readonly ILogger Logger -``` - -Field value
[net.adamec.lib.common.logging.ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -##
ServiceCollectionAutoOptionsExtension.ConfigureAutoOptions(IServiceCollection, IConfiguration, Assembly[]) Method ## -Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) -Assembly: net.adamec.lib.common -Type: [ServiceCollectionAutoOptionsExtension](#t-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension__1p9fgao) -Sources: di\config\extensions\ServiceCollectionAutoOptionsExtension.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Scans given assemblies for classes marked with [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI - - - -```csharp -public static IServiceCollection ConfigureAutoOptions(this IServiceCollection services, IConfiguration configuration, Assembly[] assemblies) -``` - -Method parameters
Microsoft.Extensions.DependencyInjection.IServiceCollection services
Service collection
Microsoft.Extensions.Configuration.IConfiguration configuration
Configuration
System.Reflection.Assembly[] assemblies
Assemblies to scan
-Return value
Microsoft.Extensions.DependencyInjection.IServiceCollection
Service collection
- - -### Exceptions ### -
System.ArgumentNullException
services or assemblies is `null`
[ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
Can get 'services.Configure' method
[ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
Can't invoke 'services.Configure<type>(section)'
[ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj)
Can't create the instance of options (configuration) class
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionAutoOptionsExtension.ConfigureAutoOptions(IServiceCollection, IConfigurationRoot, Assembly[]) Method ## -Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) -Assembly: net.adamec.lib.common -Type: [ServiceCollectionAutoOptionsExtension](#t-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension__1p9fgao) -Sources: di\config\extensions\ServiceCollectionAutoOptionsExtension.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Scans given assemblies for classes marked with [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI - - - -```csharp -public static IServiceCollection ConfigureAutoOptions(this IServiceCollection services, IConfigurationRoot configuration, Assembly[] assemblies) -``` - -Method parameters
Microsoft.Extensions.DependencyInjection.IServiceCollection services
Service collection
Microsoft.Extensions.Configuration.IConfigurationRoot configuration
Configuration root
System.Reflection.Assembly[] assemblies
Assemblies to scan
-Return value
Microsoft.Extensions.DependencyInjection.IServiceCollection
Service collection
- - -### Exceptions ### -
System.ArgumentNullException
services or assemblies is `null`
[ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
Can get 'services.Configure' method
[ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
Can't invoke 'services.Configure<type>(section)'
[ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj)
Can't create the instance of options (configuration) class
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionConfigureDirectExtensions Class ## -Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) -Assembly: net.adamec.lib.common -Sources: di\config\extensions\ServiceCollectionConfigureDirectExtensions.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Extensions for options (configuration) class registration into MS DI - - - -```csharp -internal static class ServiceCollectionConfigureDirectExtensions -``` - -Inheritance: object - - - -### Methods ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ConfigureDirect(IServiceCollection, Type, IConfiguration)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect_microsoft.extensions.dependencyinjection.iservicecollection-system.type-microsoft.extensions.configuration.iconfiguration___1lbalbi) | public static | Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI. | - | [ConfigureDirect<TConfig>(IServiceCollection, IConfiguration)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect--1_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration___1049ily) | public static | Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI. | - | [ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, Func<TConfig>)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect--1_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration-system.func_--0____1uka1kl) | public static | Gets the instance of the options (configuration) class from pocoProvider , binds (fills) it to the configuration and registers is as singleton into MS DI. | - | [ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, ServiceCollectionConfigureDirectExtensions.TConfig)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect--1_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration---0___18sq65m) | public static | Binds (fills) given instance of the options (configuration) class to configuration and registers is as singleton into MS DI. | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionConfigureDirectExtensions.ConfigureDirect(IServiceCollection, Type, IConfiguration) Method ## -Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) -Assembly: net.adamec.lib.common -Type: [ServiceCollectionConfigureDirectExtensions](#t-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions__wdwckv) -Sources: di\config\extensions\ServiceCollectionConfigureDirectExtensions.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI. - - - -```csharp -public static object ConfigureDirect(this IServiceCollection services, Type type, IConfiguration configuration) -``` - -Method parameters
Microsoft.Extensions.DependencyInjection.IServiceCollection services
MS DI Service collection
System.Type type
Type of options (configuration) class to register as singleton
Microsoft.Extensions.Configuration.IConfiguration configuration
-Return value
object
Options (configuration) class instance registered as singleton
- - -### Exceptions ### -
System.ArgumentNullException
services or configuration is `null`
[ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj)
Can't create the instance of options (configuration) class
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionConfigureDirectExtensions.ConfigureDirect<TConfig>(IServiceCollection, IConfiguration) Method ## -Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) -Assembly: net.adamec.lib.common -Type: [ServiceCollectionConfigureDirectExtensions](#t-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions__wdwckv) -Sources: di\config\extensions\ServiceCollectionConfigureDirectExtensions.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI. - - - -```csharp -public static ServiceCollectionConfigureDirectExtensions.TConfig ConfigureDirect(this IServiceCollection services, IConfiguration configuration) where TConfig: class, new() -``` - -Type parameters
TConfig
Type of options (configuration) class to register as singleton
-Method parameters
Microsoft.Extensions.DependencyInjection.IServiceCollection services
MS DI Service collection
Microsoft.Extensions.Configuration.IConfiguration configuration
Configuration (data) to be filled into the options class instance
-Return value
net.adamec.lib.common.di.config.extensions.ServiceCollectionConfigureDirectExtensions.TConfig
Options (configuration) class instance registered as singleton
- - -### Exceptions ### -
System.ArgumentNullException
services or configuration is `null`
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionConfigureDirectExtensions.ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, Func<TConfig>) Method ## -Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) -Assembly: net.adamec.lib.common -Type: [ServiceCollectionConfigureDirectExtensions](#t-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions__wdwckv) -Sources: di\config\extensions\ServiceCollectionConfigureDirectExtensions.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Gets the instance of the options (configuration) class from pocoProvider , binds (fills) it to the configuration and registers is as singleton into MS DI. - - - -```csharp -public static ServiceCollectionConfigureDirectExtensions.TConfig ConfigureDirect(this IServiceCollection services, IConfiguration configuration, Func pocoProvider) where TConfig: class -``` - -Type parameters
TConfig
Type of options (configuration) class to register as singleton
-Method parameters
Microsoft.Extensions.DependencyInjection.IServiceCollection services
MS DI Service collection
Microsoft.Extensions.Configuration.IConfiguration configuration
Configuration (data) to be filled into the options class instance
System.Func<TConfig> pocoProvider
Delegate of function that will provide the options (configuration) class instance
-Return value
net.adamec.lib.common.di.config.extensions.ServiceCollectionConfigureDirectExtensions.TConfig
Options (configuration) class instance registered as singleton
- - -### Exceptions ### -
System.ArgumentNullException
One of the parameters is `null`
System.Exception
A delegate callback throws an exception.
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ServiceCollectionConfigureDirectExtensions.ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, ServiceCollectionConfigureDirectExtensions.TConfig) Method ## -Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) -Assembly: net.adamec.lib.common -Type: [ServiceCollectionConfigureDirectExtensions](#t-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions__wdwckv) -Sources: di\config\extensions\ServiceCollectionConfigureDirectExtensions.cs -Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - - -Binds (fills) given instance of the options (configuration) class to configuration and registers is as singleton into MS DI. - - - -```csharp -public static ServiceCollectionConfigureDirectExtensions.TConfig ConfigureDirect(this IServiceCollection services, IConfiguration configuration, ServiceCollectionConfigureDirectExtensions.TConfig config) where TConfig: class -``` - -Type parameters
TConfig
Type of options (configuration) class to register as singleton
-Method parameters
Microsoft.Extensions.DependencyInjection.IServiceCollection services
MS DI Service collection
Microsoft.Extensions.Configuration.IConfiguration configuration
Configuration (data) to be filled into the options class instance
net.adamec.lib.common.di.config.extensions.ServiceCollectionConfigureDirectExtensions.TConfig config
-Return value
net.adamec.lib.common.di.config.extensions.ServiceCollectionConfigureDirectExtensions.TConfig
Options (configuration) class instance registered as singleton
- - -### Exceptions ### -
System.ArgumentNullException
One of the parameters is `null`
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## net.adamec.lib.common.di.postinit Namespace ## -### Classes ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.postinit.containerbuilderextensions__7mjuw3) | internal static | Autofac Autofac.ContainerBuilder extensions | - | [PostInitAttribute](#t-net.adamec.lib.common.di.postinit.postinitattribute__qimmrl) | public | Allows to run post init method of component. Component must be registered using the Component attribute as singleton in root scope and must register self Parameters of "marked" post init method are resolved from container (throws an exception on failure) | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ContainerBuilderExtensions Class ## -Namespace: [net.adamec.lib.common.di.postinit](#n-net.adamec.lib.common.di.postinit__ylne5f) -Assembly: net.adamec.lib.common -Sources: di\postinit\ContainerBuilderExtensions.cs -Source-only packages: [RadCommons.di.PostInit](#src-only-package--RadCommons.di.PostInit) - - -Autofac Autofac.ContainerBuilder extensions - - - -```csharp -internal static class ContainerBuilderExtensions -``` - -Inheritance: object - - - -### Fields ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [Logger](#f-net.adamec.lib.common.di.postinit.containerbuilderextensions.logger__1tek0s3) | private static | Logger | - - - - -### Methods ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [AddComponentPostInitSupport(ContainerBuilder)](#m-net.adamec.lib.common.di.postinit.containerbuilderextensions.addcomponentpostinitsupport_autofac.containerbuilder___nsekfd) | public static | Adds the support of [PostInitAttribute](#t-net.adamec.lib.common.di.postinit.postinitattribute__qimmrl) to the Autofac container builder. | - | [ProcessComponentPostInit(IContainer)](#m-net.adamec.lib.common.di.postinit.containerbuilderextensions.processcomponentpostinit_autofac.icontainer___uo3mji) | private static | Executes the components' post init methods | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ContainerBuilderExtensions.Logger Field ## -Namespace: [net.adamec.lib.common.di.postinit](#n-net.adamec.lib.common.di.postinit__ylne5f) -Assembly: net.adamec.lib.common -Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.postinit.containerbuilderextensions__7mjuw3) -Sources: di\postinit\ContainerBuilderExtensions.cs -Source-only packages: [RadCommons.di.PostInit](#src-only-package--RadCommons.di.PostInit) - - -Logger - - - -```csharp -private static readonly ILogger Logger -``` - -Field value
[net.adamec.lib.common.logging.ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -##
ContainerBuilderExtensions.AddComponentPostInitSupport(ContainerBuilder) Method ## -Namespace: [net.adamec.lib.common.di.postinit](#n-net.adamec.lib.common.di.postinit__ylne5f) -Assembly: net.adamec.lib.common -Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.postinit.containerbuilderextensions__7mjuw3) -Sources: di\postinit\ContainerBuilderExtensions.cs -Source-only packages: [RadCommons.di.PostInit](#src-only-package--RadCommons.di.PostInit) - - -Adds the support of [PostInitAttribute](#t-net.adamec.lib.common.di.postinit.postinitattribute__qimmrl) to the Autofac container builder. - - - -```csharp -public static ContainerBuilder AddComponentPostInitSupport(this ContainerBuilder builder) -``` - -Method parameters
Autofac.ContainerBuilder builder
-Return value
Autofac.ContainerBuilder
Autofac container builder
- - -### Remarks ### -Registers the [ProcessComponentPostInit(IContainer)](#m-net.adamec.lib.common.di.postinit.containerbuilderextensions.processcomponentpostinit_autofac.icontainer___uo3mji) method as a container-built-callback - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -##
ContainerBuilderExtensions.ProcessComponentPostInit(IContainer) Method ## -Namespace: [net.adamec.lib.common.di.postinit](#n-net.adamec.lib.common.di.postinit__ylne5f) -Assembly: net.adamec.lib.common -Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.postinit.containerbuilderextensions__7mjuw3) -Sources: di\postinit\ContainerBuilderExtensions.cs -Source-only packages: [RadCommons.di.PostInit](#src-only-package--RadCommons.di.PostInit) - - -Executes the components' post init methods - - - -```csharp -private static void ProcessComponentPostInit(IContainer container) -``` - -Method parameters
Autofac.IContainer container
-Return value
void
- - -### Remarks ### -Checks Autofac registry for the services with [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) that register themselves (so the interface registrations are excluded). For such components (services) it tries to find the methods marked with [PostInitAttribute](#t-net.adamec.lib.common.di.postinit.postinitattribute__qimmrl) and execute them. When the method has the parameters, it will try to resolve the from the container - - -### Exceptions ### -
System.Exception
Can't resolve the post init method parameter from container or can't get the component instance from container
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## PostInitAttribute Class ## -Namespace: [net.adamec.lib.common.di.postinit](#n-net.adamec.lib.common.di.postinit__ylne5f) -Assembly: net.adamec.lib.common -Sources: di\postinit\PostInitAttribute.cs -Source-only packages: [RadCommons.di.PostInit](#src-only-package--RadCommons.di.PostInit) - - -Allows to run post init method of component. Component must be registered using the Component attribute as singleton in root scope and must register self Parameters of "marked" post init method are resolved from container (throws an exception on failure) - - - -```csharp -[AttributeUsage(System.AttributeTargets.Method, AllowMultiple = false)] -public class PostInitAttribute : Attribute -``` - -Inheritance: object -> Attribute -Attributes: System.AttributeUsageAttribute - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## net.adamec.lib.common.extensions Namespace ## -### Classes ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ArrayExtensions](#t-net.adamec.lib.common.extensions.arrayextensions__icw7wf) | internal static | Array extensions | - | [EnumeratorExtensions](#t-net.adamec.lib.common.extensions.enumeratorextensions__obwbb2) | internal static | System.Collections.Generic.IEnumerator`1 class extensions | - | [IEnumerableExtensions](#t-net.adamec.lib.common.extensions.ienumerableextensions__1a6urvh) | internal static | System.Collections.Generic.IEnumerable`1 extensions | - | [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) | internal static | System.String class extensions | - | [TypeExtensions](#t-net.adamec.lib.common.extensions.typeextensions__63ezc8) | internal static | System.Type extensions | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ArrayExtensions Class ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Sources: extensions\ArrayExtensionsAppendBytes.cs, extensions\ArrayExtensionsFill.cs -Source-only packages: [RadCommons.extensions.ArrayExtensions.ConcatenateBytes](#src-only-package--RadCommons.extensions.ArrayExtensions.ConcatenateBytes), [RadCommons.extensions.ArrayExtensions.Fill](#src-only-package--RadCommons.extensions.ArrayExtensions.Fill) - - -Array extensions - - - -```csharp -internal static class ArrayExtensions -``` - -Inheritance: object - - - -### Methods ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [AppendBytes(byte[], byte[])](#m-net.adamec.lib.common.extensions.arrayextensions.appendbytes_system.byte__-system.byte_____1lkijjg) | public static | Adds the byte array to the current one and returns resulting array (concatenates two byte arrays into a new one) | - | [Fill<T>(ArrayExtensions.T[], ArrayExtensions.T)](#m-net.adamec.lib.common.extensions.arrayextensions.fill--1_--0__---0___6j19g1) | public static | Fills the array or T with defaultValue | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ArrayExtensions.AppendBytes(byte[], byte[]) Method ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Type: [ArrayExtensions](#t-net.adamec.lib.common.extensions.arrayextensions__icw7wf) -Sources: extensions\ArrayExtensionsAppendBytes.cs -Source-only packages: [RadCommons.extensions.ArrayExtensions.ConcatenateBytes](#src-only-package--RadCommons.extensions.ArrayExtensions.ConcatenateBytes) - - -Adds the byte array to the current one and returns resulting array (concatenates two byte arrays into a new one) - - - -```csharp -public static byte[] AppendBytes(this byte[] original, byte[] addedBytes) -``` - -Method parameters
byte[] original
Original byte array
byte[] addedBytes
Bytes to add
-Return value
byte[]
New concatenated byte array ( original + addedBytes )
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ArrayExtensions.Fill<T>(ArrayExtensions.T[], ArrayExtensions.T) Method ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Type: [ArrayExtensions](#t-net.adamec.lib.common.extensions.arrayextensions__icw7wf) -Sources: extensions\ArrayExtensionsFill.cs -Source-only packages: [RadCommons.extensions.ArrayExtensions.Fill](#src-only-package--RadCommons.extensions.ArrayExtensions.Fill) - - -Fills the array or T with defaultValue - - - -```csharp -public static void Fill(this ArrayExtensions.T[] array, ArrayExtensions.T defaultValue) -``` - -Type parameters
T
array item type
-Method parameters
net.adamec.lib.common.extensions.ArrayExtensions.T[] array
Array to fill
net.adamec.lib.common.extensions.ArrayExtensions.T defaultValue
Value to fill the array with
-Return value
void
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## EnumeratorExtensions Class ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Sources: extensions\EnumeratorExtensionsToEnumerable.cs -Source-only packages: [RadCommons.extensions.EnumeratorExtensions.ToEnumerable](#src-only-package--RadCommons.extensions.EnumeratorExtensions.ToEnumerable) - - -System.Collections.Generic.IEnumerator`1 class extensions - - - -```csharp -internal static class EnumeratorExtensions -``` - -Inheritance: object - - - -### Methods ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ToEnumerable<T>(IEnumerator)](#m-net.adamec.lib.common.extensions.enumeratorextensions.toenumerable--1_system.collections.ienumerator___fs1sul) | public static | Transforms the enumerator to System.Collections.Generic.IEnumerable`1 | - | [ToEnumerable<T>(IEnumerator<T>)](#m-net.adamec.lib.common.extensions.enumeratorextensions.toenumerable--1_system.collections.generic.ienumerator_--0____1e4iyhs) | public static | Transforms the enumerator to System.Collections.Generic.IEnumerable`1 | - | [ToList<T>(IEnumerator)](#m-net.adamec.lib.common.extensions.enumeratorextensions.tolist--1_system.collections.ienumerator___lgcqeh) | public static | Transforms the enumerator to System.Collections.Generic.List`1 | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## EnumeratorExtensions.ToEnumerable<T>(IEnumerator) Method ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Type: [EnumeratorExtensions](#t-net.adamec.lib.common.extensions.enumeratorextensions__obwbb2) -Sources: extensions\EnumeratorExtensionsToEnumerable.cs -Source-only packages: [RadCommons.extensions.EnumeratorExtensions.ToEnumerable](#src-only-package--RadCommons.extensions.EnumeratorExtensions.ToEnumerable) - - -Transforms the enumerator to System.Collections.Generic.IEnumerable`1 - - - -```csharp -public static IEnumerable ToEnumerable(this IEnumerator enumerator) -``` - -Type parameters
T
Type of objects held in enumerator/enumerable
-Method parameters
IEnumerator enumerator
Enumerator to transforms
-Return value
IEnumerable<T>
System.Collections.Generic.IEnumerable`1 based on given enumerator
- - -### Exceptions ### -
System.ArgumentNullException
enumerator is null
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## EnumeratorExtensions.ToEnumerable<T>(IEnumerator<T>) Method ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Type: [EnumeratorExtensions](#t-net.adamec.lib.common.extensions.enumeratorextensions__obwbb2) -Sources: extensions\EnumeratorExtensionsToEnumerable.cs -Source-only packages: [RadCommons.extensions.EnumeratorExtensions.ToEnumerable](#src-only-package--RadCommons.extensions.EnumeratorExtensions.ToEnumerable) - - -Transforms the enumerator to System.Collections.Generic.IEnumerable`1 - - - -```csharp -public static IEnumerable ToEnumerable(this IEnumerator enumerator) -``` - -Type parameters
T
Type of objects held in enumerator/enumerable
-Method parameters
IEnumerator<T> enumerator
Enumerator to transforms
-Return value
IEnumerable<T>
System.Collections.Generic.IEnumerable`1 based on given enumerator
- - -### Exceptions ### -
System.ArgumentNullException
enumerator is null
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## EnumeratorExtensions.ToList<T>(IEnumerator) Method ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Type: [EnumeratorExtensions](#t-net.adamec.lib.common.extensions.enumeratorextensions__obwbb2) -Sources: extensions\EnumeratorExtensionsToEnumerable.cs -Source-only packages: [RadCommons.extensions.EnumeratorExtensions.ToEnumerable](#src-only-package--RadCommons.extensions.EnumeratorExtensions.ToEnumerable) - - -Transforms the enumerator to System.Collections.Generic.List`1 - - - -```csharp -public static List ToList(this IEnumerator enumerator) -``` - -Type parameters
T
Type of objects held in enumerator/list
-Method parameters
IEnumerator enumerator
Enumerator to transforms
-Return value
List<T>
System.Collections.Generic.List`1 based on given enumerator
- - -### Exceptions ### -
System.ArgumentNullException
enumerator is null
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## IEnumerableExtensions Class ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Sources: extensions\IEnumerableExtensionsForEach.cs -Source-only packages: [RadCommons.extensions.IEnumerableExtensions.ForEach](#src-only-package--RadCommons.extensions.IEnumerableExtensions.ForEach) - - -System.Collections.Generic.IEnumerable`1 extensions - - - -```csharp -internal static class IEnumerableExtensions -``` - -Inheritance: object - - - -### Methods ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ForEach<T>(IEnumerable<T>, Action<T>)](#m-net.adamec.lib.common.extensions.ienumerableextensions.foreach--1_system.collections.generic.ienumerable_--0_-system.action_--0____nwdpsf) | public static | Invokes action for each item of enumerable | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## IEnumerableExtensions.ForEach<T>(IEnumerable<T>, Action<T>) Method ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Type: [IEnumerableExtensions](#t-net.adamec.lib.common.extensions.ienumerableextensions__1a6urvh) -Sources: extensions\IEnumerableExtensionsForEach.cs -Source-only packages: [RadCommons.extensions.IEnumerableExtensions.ForEach](#src-only-package--RadCommons.extensions.IEnumerableExtensions.ForEach) - - -Invokes action for each item of enumerable - - - -```csharp -public static void ForEach(this IEnumerable enumerable, Action action) -``` - -Type parameters
T
Enumerable item type
-Method parameters
IEnumerable<T> enumerable
Enumerable
System.Action<T> action
Action to invoke for each item of enumerable
-Return value
void
- - -### Exceptions ### -
System.ArgumentNullException
action is null
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## StringExtensions Class ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Sources: extensions\StringExtensionsCase.cs, extensions\StringExtensionsHtml.cs, extensions\StringExtensionsParts.cs, extensions\StringExtensionsPaths.cs, extensions\StringExtensionsWhitespace.cs -Source-only packages: [RadCommons.extensions.StringExtensions.Case](#src-only-package--RadCommons.extensions.StringExtensions.Case), [RadCommons.extensions.StringExtensions.Html](#src-only-package--RadCommons.extensions.StringExtensions.Html), [RadCommons.extensions.StringExtensions.Parts](#src-only-package--RadCommons.extensions.StringExtensions.Parts), [RadCommons.extensions.StringExtensions.Paths](#src-only-package--RadCommons.extensions.StringExtensions.Paths), [RadCommons.extensions.StringExtensions.Whitespace](#src-only-package--RadCommons.extensions.StringExtensions.Whitespace) - - -System.String class extensions - - - -```csharp -internal static class StringExtensions -``` - -Inheritance: object - - - -### Methods ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [AddPath(string, string)](#m-net.adamec.lib.common.extensions.stringextensions.addpath_system.string-system.string___1m9wwnx) | public static | Adds next path segment to string representing path to the file system | - | [FirstLetterToUpper(string)](#m-net.adamec.lib.common.extensions.stringextensions.firstlettertoupper_system.string___12nwwlc) | public static | Converts the first letter of string to upper case | - | [HtmlDecode(string)](#m-net.adamec.lib.common.extensions.stringextensions.htmldecode_system.string___kajpem) | public static | HTML decodes the string | - | [HtmlEncode(string)](#m-net.adamec.lib.common.extensions.stringextensions.htmlencode_system.string___1ozzgea) | public static | HTML encodes the string | - | [LastPart(string, string)](#m-net.adamec.lib.common.extensions.stringextensions.lastpart_system.string-system.string___t4lkjk) | public static | Returns the part of the string after the last occurence of the separator The result is always trimmed | - | [SplitByFirstSpace(string, string)](#m-net.adamec.lib.common.extensions.stringextensions.splitbyfirstspace_system.string-system.string-___d5xnpu) | public static | Splits the string by first space and returns the "before" part. The "after" part is provided in output parameter rest Both result and rest are trimmed | - | [ToCamelCase(string)](#m-net.adamec.lib.common.extensions.stringextensions.tocamelcase_system.string___xq94l0) | public static | Simple CamelCase converter | - | [TrimAndMergeLines(string)](#m-net.adamec.lib.common.extensions.stringextensions.trimandmergelines_system.string___1371ffr) | public static | "Full" trim of the string - the lines within the string are trimmed and then the lines are merged with the space as a separator (instead of the line break) | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## StringExtensions.AddPath(string, string) Method ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) -Sources: extensions\StringExtensionsPaths.cs -Source-only packages: [RadCommons.extensions.StringExtensions.Paths](#src-only-package--RadCommons.extensions.StringExtensions.Paths) - - -Adds next path segment to string representing path to the file system - - - -```csharp -public static string AddPath(this string str, string nextSegment) -``` - -Method parameters
string str
String representing path to the file system
string nextSegment
Next path segment
-Return value
string
String representing path to the file system
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## StringExtensions.FirstLetterToUpper(string) Method ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) -Sources: extensions\StringExtensionsCase.cs -Source-only packages: [RadCommons.extensions.StringExtensions.Case](#src-only-package--RadCommons.extensions.StringExtensions.Case) - - -Converts the first letter of string to upper case - - - -```csharp -public static string FirstLetterToUpper(this string str) -``` - -Method parameters
string str
String to convert
-Return value
string
String with the first letter in upper case
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## StringExtensions.HtmlDecode(string) Method ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) -Sources: extensions\StringExtensionsHtml.cs -Source-only packages: [RadCommons.extensions.StringExtensions.Html](#src-only-package--RadCommons.extensions.StringExtensions.Html) - - -HTML decodes the string - - - -```csharp -public static string HtmlDecode(this string str) -``` - -Method parameters
string str
String to decode
-Return value
string
HTML decoded string
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## StringExtensions.HtmlEncode(string) Method ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) -Sources: extensions\StringExtensionsHtml.cs -Source-only packages: [RadCommons.extensions.StringExtensions.Html](#src-only-package--RadCommons.extensions.StringExtensions.Html) - - -HTML encodes the string - - - -```csharp -public static string HtmlEncode(this string str) -``` - -Method parameters
string str
String to encode
-Return value
string
HTML encoded string
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## StringExtensions.LastPart(string, string) Method ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) -Sources: extensions\StringExtensionsParts.cs -Source-only packages: [RadCommons.extensions.StringExtensions.Parts](#src-only-package--RadCommons.extensions.StringExtensions.Parts) - - -Returns the part of the string after the last occurence of the separator The result is always trimmed - - - -```csharp -public static string LastPart(this string input, string separator) -``` - -Method parameters
string input
Input string
string separator
Part separator
-Return value
string
Part of the string after the last occurence of the separator or the input string when no separator detected
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## StringExtensions.SplitByFirstSpace(string, string) Method ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) -Sources: extensions\StringExtensionsParts.cs -Source-only packages: [RadCommons.extensions.StringExtensions.Parts](#src-only-package--RadCommons.extensions.StringExtensions.Parts) - - -Splits the string by first space and returns the "before" part. The "after" part is provided in output parameter rest Both result and rest are trimmed - - - -```csharp -public static string SplitByFirstSpace(this string input, out string rest) -``` - -Method parameters
string input
Input string
string rest
The part of string after the first space or null if there is no space
-Return value
string
Part of the string before the first space or the whole string if no space detected
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## StringExtensions.ToCamelCase(string) Method ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) -Sources: extensions\StringExtensionsCase.cs -Source-only packages: [RadCommons.extensions.StringExtensions.Case](#src-only-package--RadCommons.extensions.StringExtensions.Case) - - -Simple CamelCase converter - - - -```csharp -public static string ToCamelCase(this string str) -``` - -Method parameters
string str
String to convert to Camel Case
-Return value
string
Camel Case converted string
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## StringExtensions.TrimAndMergeLines(string) Method ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) -Sources: extensions\StringExtensionsWhitespace.cs -Source-only packages: [RadCommons.extensions.StringExtensions.Whitespace](#src-only-package--RadCommons.extensions.StringExtensions.Whitespace) - - -"Full" trim of the string - the lines within the string are trimmed and then the lines are merged with the space as a separator (instead of the line break) - - - -```csharp -public static string TrimAndMergeLines(this string str) -``` - -Method parameters
string str
String to full trim
-Return value
string
"Fully" trimmed string
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## TypeExtensions Class ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Sources: extensions\TypeExtensionsDefaultValue.cs -Source-only packages: [RadCommons.extensions.TypeExtensions.DefaultValue](#src-only-package--RadCommons.extensions.TypeExtensions.DefaultValue) - - -System.Type extensions - - - -```csharp -internal static class TypeExtensions -``` - -Inheritance: object - - - -### Methods ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [GetDefaultValue(Type)](#m-net.adamec.lib.common.extensions.typeextensions.getdefaultvalue_system.type___vn2w69) | public static | Gets the default value of given type | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## TypeExtensions.GetDefaultValue(Type) Method ## -Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) -Assembly: net.adamec.lib.common -Type: [TypeExtensions](#t-net.adamec.lib.common.extensions.typeextensions__63ezc8) -Sources: extensions\TypeExtensionsDefaultValue.cs -Source-only packages: [RadCommons.extensions.TypeExtensions.DefaultValue](#src-only-package--RadCommons.extensions.TypeExtensions.DefaultValue) - - -Gets the default value of given type - - - -```csharp -public static object GetDefaultValue(this Type type) -``` - -Method parameters
System.Type type
-Return value
object
Default value of given type . Null for non-value types, new instance for value types.
- - -### Exceptions ### -
System.ArgumentNullException
type is null
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## net.adamec.lib.common.logging Namespace ## -### Classes ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [CommonLogging](#t-net.adamec.lib.common.logging.commonlogging__1dar5wb) | internal static | [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) factory | - | [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) | internal | Extended logger implementing [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) | - - - - -### Interfaces ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) | internal abstract | Logger interface - wrapper around the NLog.ILogger with some additional methods | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## CommonLogging Class ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Sources: logging\CommonLogging.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -[ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) factory - - - -```csharp -internal static class CommonLogging -``` - -Inheritance: object - - - -### Methods ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [CreateLogger(string)](#m-net.adamec.lib.common.logging.commonlogging.createlogger_system.string___wn77if) | public static | Creates the logger with given categoryName | - | [CreateLogger(Type)](#m-net.adamec.lib.common.logging.commonlogging.createlogger_system.type___uhum9e) | public static | Creates the logger for given type. The name of the logger will be System.Type.FullName | - | [CreateLogger<T>()](#m-net.adamec.lib.common.logging.commonlogging.createlogger--1__lp2vax) | public static | Creates the logger for given type. The name of the logger will be System.Type.FullName | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## CommonLogging.CreateLogger(string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [CommonLogging](#t-net.adamec.lib.common.logging.commonlogging__1dar5wb) -Sources: logging\CommonLogging.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Creates the logger with given categoryName - - - -```csharp -public static ILogger CreateLogger(string categoryName) -``` - -Method parameters
string categoryName
Name of the logger
-Return value
[net.adamec.lib.common.logging.ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
Logger instance
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## CommonLogging.CreateLogger(Type) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [CommonLogging](#t-net.adamec.lib.common.logging.commonlogging__1dar5wb) -Sources: logging\CommonLogging.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Creates the logger for given type. The name of the logger will be System.Type.FullName - - - -```csharp -public static ILogger CreateLogger(Type type) -``` - -Method parameters
System.Type type
Type to create the logger for
-Return value
[net.adamec.lib.common.logging.ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
Logger instance
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## CommonLogging.CreateLogger<T>() Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [CommonLogging](#t-net.adamec.lib.common.logging.commonlogging__1dar5wb) -Sources: logging\CommonLogging.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Creates the logger for given type. The name of the logger will be System.Type.FullName - - - -```csharp -public static ILogger CreateLogger() -``` - -Type parameters
T
Type to create the logger for
-Return value
[net.adamec.lib.common.logging.ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
Logger instance
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt Class ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Sources: logging\LoggerExt.CorrelationId.cs, logging\LoggerExt.cs, logging\LoggerExt.EventProperties.cs, logging\LoggerExt.ExceptionFilter.cs, logging\LoggerExt.ExceptionPassThrough.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging), [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging), [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging), [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging), [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Extended logger implementing [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) - - - -```csharp -internal class LoggerExt : Logger, ILogger -``` - -Inheritance: object -> NLog.Logger -Implements: [net.adamec.lib.common.logging.ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm), NLog.ILogger, NLog.ILoggerBase, NLog.ISuppress - - -### Methods ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [CreateException<TException>(string, string, Exception)](#m-net.adamec.lib.common.logging.loggerext.createexception--1_system.string-system.string--system.exception___1kt7m7i) | private static | Writes the diagnostic message at the `Fatal` level. Creates and returns the exception of given type | - | [Debug(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.loggerext.debug_system.collections.generic.dictionary_system.string-system.object_-system.string___by66ma) | public | Writes the diagnostic message at the `Debug` level. | - | [DebugCorr(string, string)](#m-net.adamec.lib.common.logging.loggerext.debugcorr_system.string-system.string___i119af) | public | Writes the diagnostic message at the `Debug` level with correlation ID. | - | [Error(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.logging.loggerext.error_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___7fy00h) | public | Writes the diagnostic message at the `Error` level. | - | [Error(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.loggerext.error_system.collections.generic.dictionary_system.string-system.object_-system.string___u5pc5h) | public | Writes the diagnostic message at the `Error` level. | - | [Error<TException>(string, Exception)](#m-net.adamec.lib.common.logging.loggerext.error--1_system.string-system.exception___1qowqgx) | public | Writes the diagnostic message at the `Error` level. Creates and returns the exception of given type | - | [ErrorCorr(string, Exception, string)](#m-net.adamec.lib.common.logging.loggerext.errorcorr_system.string-system.exception-system.string___1tdd1hu) | public | Writes the diagnostic message at the `Error` level with correlation ID. | - | [ErrorCorr(string, string)](#m-net.adamec.lib.common.logging.loggerext.errorcorr_system.string-system.string___1vt0qk2) | public | Writes the diagnostic message at the `Error` level with correlation ID. | - | [ErrorCorr<TException>(string, LoggerExt.TException, string)](#m-net.adamec.lib.common.logging.loggerext.errorcorr--1_system.string---0-system.string___bk3vj3) | public | Writes the diagnostic message at the `Error` level and returns the exception of given type | - | [ErrorCorr<TException>(string, string, Exception)](#m-net.adamec.lib.common.logging.loggerext.errorcorr--1_system.string-system.string-system.exception___4hcjn7) | public | Writes the diagnostic message at the `Error` level with correlation ID. Creates and returns the exception of given type | - | [ErrorFltr<TException>(LoggerExt.TException, string, bool)](#m-net.adamec.lib.common.logging.loggerext.errorfltr--1_--0-system.string-system.boolean___ipfsfa) | public | Writes the diagnostic message at the `Error` level and returns the exception of given type | - | [ErrorFltrCorr<TException>(string, LoggerExt.TException, string, bool)](#m-net.adamec.lib.common.logging.loggerext.errorfltrcorr--1_system.string---0-system.string-system.boolean___84xqu8) | public | Writes the diagnostic message at the `Error` level and returns the exception of given type | - | [ErrorPassThrough(Exception, string)](#m-net.adamec.lib.common.logging.loggerext.errorpassthrough_system.exception-system.string___1ey2kd0) | public | Writes the diagnostic message at the `Error` level and returns given exception | - | [Fatal(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.logging.loggerext.fatal_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___pw9hcn) | public | Writes the diagnostic message at the `Fatal` level. | - | [Fatal(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.loggerext.fatal_system.collections.generic.dictionary_system.string-system.object_-system.string___1ff2uef) | public | Writes the diagnostic message at the `Fatal` level. | - | [Fatal<TException>(string, Exception)](#m-net.adamec.lib.common.logging.loggerext.fatal--1_system.string-system.exception___1myw0tj) | public | Writes the diagnostic message at the `Fatal` level. Creates and returns the exception of given type | - | [FatalCorr(string, Exception, string)](#m-net.adamec.lib.common.logging.loggerext.fatalcorr_system.string-system.exception-system.string___1q1adwi) | public | Writes the diagnostic message at the `Fatal` level with correlation ID. | - | [FatalCorr(string, string)](#m-net.adamec.lib.common.logging.loggerext.fatalcorr_system.string-system.string___c131ta) | public | Writes the diagnostic message at the `Fatal` level with correlation ID. | - | [FatalCorr<TException>(string, LoggerExt.TException, string)](#m-net.adamec.lib.common.logging.loggerext.fatalcorr--1_system.string---0-system.string___17i1735) | public | Writes the diagnostic message at the `Fatal` level and returns the exception of given type | - | [FatalCorr<TException>(string, string, Exception)](#m-net.adamec.lib.common.logging.loggerext.fatalcorr--1_system.string-system.string-system.exception___w1l5gt) | public | Writes the diagnostic message at the `Fatal` level with correlation ID. Creates and returns the exception of given type | - | [FatalFltr<TException>(LoggerExt.TException, string, bool)](#m-net.adamec.lib.common.logging.loggerext.fatalfltr--1_--0-system.string-system.boolean___5rdjqe) | public | Writes the diagnostic message at the `Fatal` level and returns catchIt value. | - | [FatalFltrCorr<TException>(string, LoggerExt.TException, string, bool)](#m-net.adamec.lib.common.logging.loggerext.fatalfltrcorr--1_system.string---0-system.string-system.boolean___15t2hh0) | public | Writes the diagnostic message at the `Fatal` level and returns catchIt value. | - | [FatalPassThrough(Exception, string)](#m-net.adamec.lib.common.logging.loggerext.fatalpassthrough_system.exception-system.string___10psm2o) | public | Writes the diagnostic message at the `Fatal` level and returns given exception > | - | [Info(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.loggerext.info_system.collections.generic.dictionary_system.string-system.object_-system.string___1qxds6b) | public | Writes the diagnostic message at the `Info` level. | - | [InfoCorr(string, string)](#m-net.adamec.lib.common.logging.loggerext.infocorr_system.string-system.string___3vobha) | public | Writes the diagnostic message at the `Info` level with correlation ID. | - | [LogIt(LogLevel, Dictionary<string,object>, string, Exception, string)](#m-net.adamec.lib.common.logging.loggerext.logit_nlog.loglevel-system.collections.generic.dictionary_system.string-system.object_-system.string-system.exception-system.string___vo1jng) | private | Writes the item (message with optional event properties and exception) into the log | - | [LogIt(LogLevel, string, Exception, string)](#m-net.adamec.lib.common.logging.loggerext.logit_nlog.loglevel-system.string-system.exception-system.string___17r766x) | private | Writes the item (message with optional exception) into the log | - | [LogIt(LogLevel, string, string, Exception, string)](#m-net.adamec.lib.common.logging.loggerext.logit_nlog.loglevel-system.string-system.string-system.exception-system.string___14n4i77) | private | Writes the item (message with optional exception) with correlation Id into the log | - | [Trace(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.loggerext.trace_system.collections.generic.dictionary_system.string-system.object_-system.string___1k5wn70) | public | Writes the diagnostic message at the `Trace` level. | - | [TraceCorr(string, string)](#m-net.adamec.lib.common.logging.loggerext.tracecorr_system.string-system.string___1e218kz) | public | Writes the diagnostic message at the `Trace` level with correlation ID | - | [Warn(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.logging.loggerext.warn_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___8kyvvj) | public | Writes the diagnostic message at the `Warn` level. | - | [Warn(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.loggerext.warn_system.collections.generic.dictionary_system.string-system.object_-system.string___wuc2dz) | public | Writes the diagnostic message at the `Warn` level. | - | [WarnCorr(string, Exception, string)](#m-net.adamec.lib.common.logging.loggerext.warncorr_system.string-system.exception-system.string___sfdb1u) | public | Writes the diagnostic message at the `Warn` level with correlation ID. | - | [WarnCorr(string, string)](#m-net.adamec.lib.common.logging.loggerext.warncorr_system.string-system.string___cfr64e) | public | Writes the diagnostic message at the `Warn` level with correlation ID. | - - - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.CreateException<TException>(string, string, Exception) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Fatal` level. Creates and returns the exception of given type - - - -```csharp -private static LoggerExt.TException CreateException(string message, out string stackTrace, Exception innerException = null) where TException: Exception -``` - -Type parameters
TException
-Method parameters
string message
Log message.
string stackTrace
Stack trace to be logged in `StackTrace` event property
System.Exception innerException
Exception to be logged
-Return value
net.adamec.lib.common.logging.LoggerExt.TException
Created exception
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.Debug(Dictionary<string,object>, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Debug` level. - - - -```csharp -public void Debug(Dictionary eventProperties, [Localizable(false)] string message) -``` - -Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-Return value
void
Implements: [ILogger.Debug(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.debug_system.collections.generic.dictionary_system.string-system.object_-system.string___jxdraq) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.DebugCorr(string, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Debug` level with correlation ID. - - - -```csharp -public void DebugCorr(string correlationId, [Localizable(false)] string message) -``` - -Method parameters
string correlationId
Correlation ID
string message
Log message.
-Return value
void
Implements: [ILogger.DebugCorr(string, string)](#m-net.adamec.lib.common.logging.ilogger.debugcorr_system.string-system.string___aozvfj) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.Error(Dictionary<string,object>, Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Error` level. - - - -```csharp -public void Error(Dictionary eventProperties, Exception exception, [Localizable(false)] string message) -``` - -Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
void
Implements: [ILogger.Error(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___1watp5d) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.Error(Dictionary<string,object>, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Error` level. - - - -```csharp -public void Error(Dictionary eventProperties, [Localizable(false)] string message) -``` - -Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-Return value
void
Implements: [ILogger.Error(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.string___kfa9gl) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.Error<TException>(string, Exception) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.ExceptionPassThrough.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Error` level. Creates and returns the exception of given type - - - -```csharp -public LoggerExt.TException Error(string message, Exception innerException = null) where TException: Exception -``` - -Type parameters
TException
-Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
-Return value
net.adamec.lib.common.logging.LoggerExt.TException
Created exception
Implements: [ILogger.Error<TException>(string, Exception)](#m-net.adamec.lib.common.logging.ilogger.error--1_system.string-system.exception___pmrssh) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.ErrorCorr(string, Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Error` level with correlation ID. - - - -```csharp -public void ErrorCorr(string correlationId, Exception exception, [Localizable(false)] string message) -``` - -Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
void
Implements: [ILogger.ErrorCorr(string, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.errorcorr_system.string-system.exception-system.string___1qll13u) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.ErrorCorr(string, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Error` level with correlation ID. - - - -```csharp -public void ErrorCorr(string correlationId, [Localizable(false)] string message) -``` - -Method parameters
string correlationId
Correlation ID
string message
Log message.
-Return value
void
Implements: [ILogger.ErrorCorr(string, string)](#m-net.adamec.lib.common.logging.ilogger.errorcorr_system.string-system.string___coifvu) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.ErrorCorr<TException>(string, LoggerExt.TException, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Error` level and returns the exception of given type - - - -```csharp -public LoggerExt.TException ErrorCorr(string correlationId, LoggerExt.TException exception, string message = null) where TException: Exception -``` - -Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
-Return value
net.adamec.lib.common.logging.LoggerExt.TException
Pass-through exception
Implements: [ILogger.ErrorCorr<TException>(string, ILogger.TException, string)](#m-net.adamec.lib.common.logging.ilogger.errorcorr--1_system.string---0-system.string___eypxkv) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.ErrorCorr<TException>(string, string, Exception) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Error` level with correlation ID. Creates and returns the exception of given type - - - -```csharp -public LoggerExt.TException ErrorCorr(string correlationId, string message, Exception innerException = null) where TException: Exception -``` - -Type parameters
TException
-Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
-Return value
net.adamec.lib.common.logging.LoggerExt.TException
Created exception
Implements: [ILogger.ErrorCorr<TException>(string, string, Exception)](#m-net.adamec.lib.common.logging.ilogger.errorcorr--1_system.string-system.string-system.exception___91akh7) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.ErrorFltr<TException>(LoggerExt.TException, string, bool) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.ExceptionFilter.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Error` level and returns the exception of given type - - - -```csharp -public bool ErrorFltr(LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception -``` - -Type parameters
TException
-Method parameters
net.adamec.lib.common.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-Return value
bool
Flag whether the exception is to be catch by exception filter
Implements: [ILogger.ErrorFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.logging.ilogger.errorfltr--1_--0-system.string-system.boolean___135nosm) - - -### Example ### -The following code logs any exception without catching it (function returns false by default) -```csharp - try - { - ... - } - catch (Exception e) when (Logger.FatalFltr(e)) {} -``` - The following code catch and log the ArgumentException and logs any other exception without catching it. -```csharp - try - { - ... - } - catch (ArgumentException e) when (Logger.ErrorFltr(e,catchIt:true)) {} - catch (Exception e) when (Logger.FatalFltr(e)) {} -``` - - - -### Remarks ### -This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.ErrorFltrCorr<TException>(string, LoggerExt.TException, string, bool) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Error` level and returns the exception of given type - - - -```csharp -public bool ErrorFltrCorr(string correlationId, LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception -``` - -Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-Return value
bool
Flag whether the exception is to be catch by exception filter
Implements: [ILogger.ErrorFltrCorr<TException>(string, ILogger.TException, string, bool)](#m-net.adamec.lib.common.logging.ilogger.errorfltrcorr--1_system.string---0-system.string-system.boolean___1spds2w) - - -### Remarks ### -This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) - - -### See Also ### -[ErrorFltr<TException>(LoggerExt.TException, string, bool)](#m-net.adamec.lib.common.logging.loggerext.errorfltr--1_--0-system.string-system.boolean___ipfsfa) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.ErrorPassThrough(Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.ExceptionPassThrough.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Error` level and returns given exception - - - -```csharp -public Exception ErrorPassThrough(Exception exception, string message = null) -``` - -Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
System.Exception
Pass-through exception
Implements: [ILogger.ErrorPassThrough(Exception, string)](#m-net.adamec.lib.common.logging.ilogger.errorpassthrough_system.exception-system.string___1vc33gk) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.Fatal(Dictionary<string,object>, Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Fatal` level. - - - -```csharp -public void Fatal(Dictionary eventProperties, Exception exception, [Localizable(false)] string message) -``` - -Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
void
Implements: [ILogger.Fatal(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___175gumn) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.Fatal(Dictionary<string,object>, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Fatal` level. - - - -```csharp -public void Fatal(Dictionary eventProperties, [Localizable(false)] string message) -``` - -Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-Return value
void
Implements: [ILogger.Fatal(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.string___1yxmkzz) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.Fatal<TException>(string, Exception) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.ExceptionPassThrough.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Fatal` level. Creates and returns the exception of given type - - - -```csharp -public LoggerExt.TException Fatal(string message, Exception innerException = null) where TException: Exception -``` - -Type parameters
TException
-Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
-Return value
net.adamec.lib.common.logging.LoggerExt.TException
Created exception
Implements: [ILogger.Fatal<TException>(string, Exception)](#m-net.adamec.lib.common.logging.ilogger.fatal--1_system.string-system.exception___x5u73) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.FatalCorr(string, Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Fatal` level with correlation ID. - - - -```csharp -public void FatalCorr(string correlationId, Exception exception, [Localizable(false)] string message) -``` - -Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
void
Implements: [ILogger.FatalCorr(string, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.fatalcorr_system.string-system.exception-system.string___yt34nm) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.FatalCorr(string, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Fatal` level with correlation ID. - - - -```csharp -public void FatalCorr(string correlationId, [Localizable(false)] string message) -``` - -Method parameters
string correlationId
Correlation ID
string message
Log message.
-Return value
void
Implements: [ILogger.FatalCorr(string, string)](#m-net.adamec.lib.common.logging.ilogger.fatalcorr_system.string-system.string___ufcx32) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.FatalCorr<TException>(string, LoggerExt.TException, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Fatal` level and returns the exception of given type - - - -```csharp -public LoggerExt.TException FatalCorr(string correlationId, LoggerExt.TException exception, string message = null) where TException: Exception -``` - -Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
-Return value
net.adamec.lib.common.logging.LoggerExt.TException
Pass-through exception
Implements: [ILogger.FatalCorr<TException>(string, ILogger.TException, string)](#m-net.adamec.lib.common.logging.ilogger.fatalcorr--1_system.string---0-system.string___108vdu1) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.FatalCorr<TException>(string, string, Exception) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Fatal` level with correlation ID. Creates and returns the exception of given type - - - -```csharp -public LoggerExt.TException FatalCorr(string correlationId, string message, Exception innerException = null) where TException: Exception -``` - -Type parameters
TException
-Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
-Return value
net.adamec.lib.common.logging.LoggerExt.TException
Created exception
Implements: [ILogger.FatalCorr<TException>(string, string, Exception)](#m-net.adamec.lib.common.logging.ilogger.fatalcorr--1_system.string-system.string-system.exception___1hlu7x) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.FatalFltr<TException>(LoggerExt.TException, string, bool) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.ExceptionFilter.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Fatal` level and returns catchIt value. - - - -```csharp -public bool FatalFltr(LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception -``` - -Type parameters
TException
-Method parameters
net.adamec.lib.common.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-Return value
bool
Flag whether the exception is to be catch by exception filter
Implements: [ILogger.FatalFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.logging.ilogger.fatalfltr--1_--0-system.string-system.boolean___1av7ixa) - - -### Remarks ### -This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) - - -### See Also ### -[ErrorFltr<TException>(LoggerExt.TException, string, bool)](#m-net.adamec.lib.common.logging.loggerext.errorfltr--1_--0-system.string-system.boolean___ipfsfa) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.FatalFltrCorr<TException>(string, LoggerExt.TException, string, bool) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Fatal` level and returns catchIt value. - - - -```csharp -public bool FatalFltrCorr(string correlationId, LoggerExt.TException exception, string message = null, bool catchIt = false) where TException: Exception -``` - -Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.LoggerExt.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-Return value
bool
Flag whether the exception is to be catch by exception filter
Implements: [ILogger.FatalFltrCorr<TException>(string, ILogger.TException, string, bool)](#m-net.adamec.lib.common.logging.ilogger.fatalfltrcorr--1_system.string---0-system.string-system.boolean___a9m338) - - -### Remarks ### -This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) - - -### See Also ### -[ErrorFltr<TException>(LoggerExt.TException, string, bool)](#m-net.adamec.lib.common.logging.loggerext.errorfltr--1_--0-system.string-system.boolean___ipfsfa) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.FatalPassThrough(Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.ExceptionPassThrough.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Fatal` level and returns given exception > - - - -```csharp -public Exception FatalPassThrough(Exception exception, string message = null) -``` - -Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
System.Exception
Pass-through exception
Implements: [ILogger.FatalPassThrough(Exception, string)](#m-net.adamec.lib.common.logging.ilogger.fatalpassthrough_system.exception-system.string___1fx8xs8) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.Info(Dictionary<string,object>, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Info` level. - - - -```csharp -public void Info(Dictionary eventProperties, [Localizable(false)] string message) -``` - -Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-Return value
void
Implements: [ILogger.Info(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.info_system.collections.generic.dictionary_system.string-system.object_-system.string___1kbhewr) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.InfoCorr(string, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Info` level with correlation ID. - - - -```csharp -public void InfoCorr(string correlationId, [Localizable(false)] string message) -``` - -Method parameters
string correlationId
Correlation ID
string message
Log message.
-Return value
void
Implements: [ILogger.InfoCorr(string, string)](#m-net.adamec.lib.common.logging.ilogger.infocorr_system.string-system.string___2iypny) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.LogIt(LogLevel, Dictionary<string,object>, string, Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the item (message with optional event properties and exception) into the log - - - -```csharp -private void LogIt(LogLevel level, Dictionary eventProperties, [Localizable(false)] string message, Exception exception = null, string stackTrace = null) -``` - -Method parameters
NLog.LogLevel level
Dictionary<string,object> eventProperties
Event properties (null when no properties are provided)
string message
Log message
System.Exception exception
Optional exception to be logged
string stackTrace
Optional stack trace to be logged in `StackTrace` event property when the System.Exception.StackTrace of exception is empty
-Return value
void
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.LogIt(LogLevel, string, Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the item (message with optional exception) into the log - - - -```csharp -private void LogIt(LogLevel level, [Localizable(false)] string message, Exception exception = null, string stackTrace = null) -``` - -Method parameters
NLog.LogLevel level
string message
Log message
System.Exception exception
Optional exception to be logged
string stackTrace
Optional stack trace to be logged in `StackTrace` event property when the System.Exception.StackTrace of exception is empty
-Return value
void
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.LogIt(LogLevel, string, string, Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the item (message with optional exception) with correlation Id into the log - - - -```csharp -private void LogIt(LogLevel level, string correlationId, [Localizable(false)] string message, Exception exception = null, string stackTrace = null) -``` - -Method parameters
NLog.LogLevel level
string correlationId
Correlation ID
string message
Log message
System.Exception exception
Optional exception to be logged
string stackTrace
Optional stack trace to be logged in `StackTrace` event property when the System.Exception.StackTrace of exception is empty
-Return value
void
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.Trace(Dictionary<string,object>, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Trace` level. - - - -```csharp -public void Trace(Dictionary eventProperties, [Localizable(false)] string message) -``` - -Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-Return value
void
Implements: [ILogger.Trace(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.trace_system.collections.generic.dictionary_system.string-system.object_-system.string___15kc02k) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.TraceCorr(string, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Trace` level with correlation ID - - - -```csharp -public void TraceCorr(string correlationId, [Localizable(false)] string message) -``` - -Method parameters
string correlationId
Correlation ID
string message
Log message.
-Return value
void
Implements: [ILogger.TraceCorr(string, string)](#m-net.adamec.lib.common.logging.ilogger.tracecorr_system.string-system.string___1bdni2z) - - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## LoggerExt.Warn(Dictionary<string,object>, Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Warn` level. + +## net.adamec.lib.common.di.config.exception Namespace ## +### Classes ### -```csharp -public void Warn(Dictionary eventProperties, Exception exception, [Localizable(false)] string message) -``` + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) | public | Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionAutoOptionsExtension | + | [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) | public | Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionConfigureDirectExtensions | -Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
void
Implements: [ILogger.Warn(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___10z37vj) + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5042,24 +1805,34 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## LoggerExt.Warn(Dictionary<string,object>, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ServiceCollectionAutoOptionsException Class ## +Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Sources: di\config\exception\ServiceCollectionAutoOptionsException.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Warn` level. +Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionAutoOptionsExtension ```csharp -public void Warn(Dictionary eventProperties, [Localizable(false)] string message) +public class ServiceCollectionAutoOptionsException : Exception ``` -Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-Return value
void
Implements: [ILogger.Warn(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.string___1hy0rp3) +Inheritance: object -> System.Exception +Implements: System.Runtime.Serialization.ISerializable + + +### Constructors ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [ServiceCollectionAutoOptionsException()](#m-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception.-ctor__o6ojyb) | public | Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) | + | [ServiceCollectionAutoOptionsException(string)](#m-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception.-ctor_system.string___1kcodie) | public | Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) | + | [ServiceCollectionAutoOptionsException(string, Exception)](#m-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception.-ctor_system.string-system.exception___r0rfi6) | public | Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) | + + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5068,181 +1841,100 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## LoggerExt.WarnCorr(string, Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ServiceCollectionAutoOptionsException.ServiceCollectionAutoOptionsException() Constructor ## +Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) +Sources: di\config\exception\ServiceCollectionAutoOptionsException.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Warn` level with correlation ID. +Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) ```csharp -public void WarnCorr(string correlationId, Exception exception, [Localizable(false)] string message) +public ServiceCollectionAutoOptionsException() ``` -Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
void
Implements: [ILogger.WarnCorr(string, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.warncorr_system.string-system.exception-system.string___1kh0i9m) - - Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## LoggerExt.WarnCorr(string, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ServiceCollectionAutoOptionsException.ServiceCollectionAutoOptionsException(string) Constructor ## +Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) Assembly: net.adamec.lib.common -Type: [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Sources: logging\LoggerExt.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) +Sources: di\config\exception\ServiceCollectionAutoOptionsException.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Warn` level with correlation ID. +Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) ```csharp -public void WarnCorr(string correlationId, [Localizable(false)] string message) +public ServiceCollectionAutoOptionsException(string message) ``` -Method parameters
string correlationId
Correlation ID
string message
Log message.
-Return value
void
Implements: [ILogger.WarnCorr(string, string)](#m-net.adamec.lib.common.logging.ilogger.warncorr_system.string-system.string___pr2tiu) - - +Constructor parameters
string message
Error message
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## ILogger Interface ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ServiceCollectionAutoOptionsException.ServiceCollectionAutoOptionsException(string, Exception) Constructor ## +Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) Assembly: net.adamec.lib.common -Sources: logging\ILogger.CorrelationId.cs, logging\ILogger.cs, logging\ILogger.EventProperties.cs, logging\ILogger.ExceptionFilter.cs, logging\ILogger.ExceptionPassThrough.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging), [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging), [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging), [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging), [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) +Sources: di\config\exception\ServiceCollectionAutoOptionsException.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Logger interface - wrapper around the NLog.ILogger with some additional methods +Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh) ```csharp -internal interface ILogger : ILogger +public ServiceCollectionAutoOptionsException(string message, Exception inner) ``` -Implemented by: [net.adamec.lib.common.logging.LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) -Implements: NLog.ILogger, NLog.ILoggerBase, NLog.ISuppress - +Constructor parameters
string message
Error message
System.Exception inner
Inner exception
+Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -### Remarks ### -The NLog supports having additional (custom) event properties provided to loggers and optionally rendered to logs. The event properties are represented as key-value dictionary, where key is the unique name of the property. Extended logger provides following methods to log with given set of the properties. - - [Trace(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.trace_system.collections.generic.dictionary_system.string-system.object_-system.string___15kc02k) , - - [Debug(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.debug_system.collections.generic.dictionary_system.string-system.object_-system.string___jxdraq) , - - [Info(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.info_system.collections.generic.dictionary_system.string-system.object_-system.string___1kbhewr) , - - [Warn(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.string___1hy0rp3) , - - [Error(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.string___kfa9gl) , - - [Fatal(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.string___1yxmkzz) , - - [Warn(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___10z37vj) , - - [Error(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___1watp5d) and - - [Fatal(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___175gumn) - - - +## ServiceCollectionConfigureDirectException Class ## +Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) +Assembly: net.adamec.lib.common +Sources: di\config\exception\ServiceCollectionConfigureDirectException.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) - Sometimes, it's useful to have an exception logging method implemented as the operation returning the exception being logged. The [ErrorPassThrough(Exception, string)](#m-net.adamec.lib.common.logging.ilogger.errorpassthrough_system.exception-system.string___1vc33gk) and [FatalPassThrough(Exception, string)](#m-net.adamec.lib.common.logging.ilogger.fatalpassthrough_system.exception-system.string___1fx8xs8) methods will log given exception and return it for further processing. -```csharp - try - { - ... - } - catch (Exception ex){ - if(logger.ErrorPassThrough(ex) is MyException){ - return null; - }else{ - throw; - } - } -``` - In the example above, the exception is always logged and then the decision/action is taken. +Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionConfigureDirectExtensions - C# 6 brought the exception filters that don't unwind the stack as the exception is not catch yet when processing the filter. It can also be used for logging the exceptions without actually catching them (when the exception filter returns `false` ). Extended logger provides functions [ErrorFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.logging.ilogger.errorfltr--1_--0-system.string-system.boolean___135nosm) and [FatalFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.logging.ilogger.fatalfltr--1_--0-system.string-system.boolean___1av7ixa) for this purpose. -```csharp - try - { - ... - } - catch (Exception ex) when (logger.ErrorFltr(ex,"Error here!"){ - //newer called as the default return value of ErrorFltr is false - } -``` - The example above logs but never catch all exceptions. The following code catch and log the ArgumentException and logs any other exception without catching it. -```csharp - try - { - ... - } - catch (ArgumentException e) when (Logger.ErrorFltr(e,catchIt:true)) { ... } - catch (Exception e) when (Logger.FatalFltr(e)) {} -``` - Logger can also create and exception, log it and return using functions [Error<TException>(string, Exception)](#m-net.adamec.lib.common.logging.ilogger.error--1_system.string-system.exception___pmrssh) and [Fatal<TException>(string, Exception)](#m-net.adamec.lib.common.logging.ilogger.fatal--1_system.string-system.exception___x5u73) ```csharp - if(value is null) throw logger.Fatal("Value is null"); +public class ServiceCollectionConfigureDirectException : Exception ``` - - When logging an exception using the [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) methods, the event property `StackTrace` is set from System.Exception.StackTrace , when the logger creates an exception, the property is set using `new StackTrace(2, true).ToString()` . In other cases when the System.Exception.StackTrace is null or empty, `new StackTrace(true).ToString()` is used. - - [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) also provides set of methods for logging with the correlation ID (for example in integration scenarios), where the given correlation ID is set to the event property `CorrelationId` . Such methods have the name ending with `Corr` suffix. - - +Inheritance: object -> System.Exception +Implements: System.Runtime.Serialization.ISerializable -### Methods ### +### Constructors ### | Name | Modifier | Summary | | ------ | ---------- | --------- | - | [Debug(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.debug_system.collections.generic.dictionary_system.string-system.object_-system.string___jxdraq) | public abstract | Writes the diagnostic message at the `Debug` level. | - | [DebugCorr(string, string)](#m-net.adamec.lib.common.logging.ilogger.debugcorr_system.string-system.string___aozvfj) | public abstract | Writes the diagnostic message at the `Debug` level with correlation ID. | - | [Error(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___1watp5d) | public abstract | Writes the diagnostic message at the `Error` level. | - | [Error(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.string___kfa9gl) | public abstract | Writes the diagnostic message at the `Error` level. | - | [Error<TException>(string, Exception)](#m-net.adamec.lib.common.logging.ilogger.error--1_system.string-system.exception___pmrssh) | public abstract | Writes the diagnostic message at the `Error` level. Creates and returns the exception of given type | - | [ErrorCorr(string, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.errorcorr_system.string-system.exception-system.string___1qll13u) | public abstract | Writes the diagnostic message at the `Error` level with correlation ID. | - | [ErrorCorr(string, string)](#m-net.adamec.lib.common.logging.ilogger.errorcorr_system.string-system.string___coifvu) | public abstract | Writes the diagnostic message at the `Error` level with correlation ID. | - | [ErrorCorr<TException>(string, ILogger.TException, string)](#m-net.adamec.lib.common.logging.ilogger.errorcorr--1_system.string---0-system.string___eypxkv) | public abstract | Writes the diagnostic message at the `Error` level and returns the exception of given type | - | [ErrorCorr<TException>(string, string, Exception)](#m-net.adamec.lib.common.logging.ilogger.errorcorr--1_system.string-system.string-system.exception___91akh7) | public abstract | Writes the diagnostic message at the `Error` level with correlation ID. Creates and returns the exception of given type | - | [ErrorFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.logging.ilogger.errorfltr--1_--0-system.string-system.boolean___135nosm) | public abstract | Writes the diagnostic message at the `Error` level and returns the exception of given type | - | [ErrorFltrCorr<TException>(string, ILogger.TException, string, bool)](#m-net.adamec.lib.common.logging.ilogger.errorfltrcorr--1_system.string---0-system.string-system.boolean___1spds2w) | public abstract | Writes the diagnostic message at the `Error` level and returns the exception of given type | - | [ErrorPassThrough(Exception, string)](#m-net.adamec.lib.common.logging.ilogger.errorpassthrough_system.exception-system.string___1vc33gk) | public abstract | Writes the diagnostic message at the `Error` level and returns given exception | - | [Fatal(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___175gumn) | public abstract | Writes the diagnostic message at the `Fatal` level. | - | [Fatal(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.string___1yxmkzz) | public abstract | Writes the diagnostic message at the `Fatal` level. | - | [Fatal<TException>(string, Exception)](#m-net.adamec.lib.common.logging.ilogger.fatal--1_system.string-system.exception___x5u73) | public abstract | Writes the diagnostic message at the `Fatal` level. Creates and returns the exception of given type | - | [FatalCorr(string, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.fatalcorr_system.string-system.exception-system.string___yt34nm) | public abstract | Writes the diagnostic message at the `Fatal` level with correlation ID. | - | [FatalCorr(string, string)](#m-net.adamec.lib.common.logging.ilogger.fatalcorr_system.string-system.string___ufcx32) | public abstract | Writes the diagnostic message at the `Fatal` level with correlation ID. | - | [FatalCorr<TException>(string, ILogger.TException, string)](#m-net.adamec.lib.common.logging.ilogger.fatalcorr--1_system.string---0-system.string___108vdu1) | public abstract | Writes the diagnostic message at the `Fatal` level and returns the exception of given type | - | [FatalCorr<TException>(string, string, Exception)](#m-net.adamec.lib.common.logging.ilogger.fatalcorr--1_system.string-system.string-system.exception___1hlu7x) | public abstract | Writes the diagnostic message at the `Fatal` level with correlation ID. Creates and returns the exception of given type | - | [FatalFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.logging.ilogger.fatalfltr--1_--0-system.string-system.boolean___1av7ixa) | public abstract | Writes the diagnostic message at the `Fatal` level and returns catchIt value. | - | [FatalFltrCorr<TException>(string, ILogger.TException, string, bool)](#m-net.adamec.lib.common.logging.ilogger.fatalfltrcorr--1_system.string---0-system.string-system.boolean___a9m338) | public abstract | Writes the diagnostic message at the `Fatal` level and returns catchIt value. | - | [FatalPassThrough(Exception, string)](#m-net.adamec.lib.common.logging.ilogger.fatalpassthrough_system.exception-system.string___1fx8xs8) | public abstract | Writes the diagnostic message at the `Fatal` level and returns given exception | - | [Info(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.info_system.collections.generic.dictionary_system.string-system.object_-system.string___1kbhewr) | public abstract | Writes the diagnostic message at the `Info` level. | - | [InfoCorr(string, string)](#m-net.adamec.lib.common.logging.ilogger.infocorr_system.string-system.string___2iypny) | public abstract | Writes the diagnostic message at the `Info` level with correlation ID. | - | [Trace(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.trace_system.collections.generic.dictionary_system.string-system.object_-system.string___15kc02k) | public abstract | Writes the diagnostic message at the `Trace` level. | - | [TraceCorr(string, string)](#m-net.adamec.lib.common.logging.ilogger.tracecorr_system.string-system.string___1bdni2z) | public abstract | Writes the diagnostic message at the `Trace` level with correlation ID. | - | [Warn(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___10z37vj) | public abstract | Writes the diagnostic message at the `Warn` level. | - | [Warn(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.string___1hy0rp3) | public abstract | Writes the diagnostic message at the `Warn` level. | - | [WarnCorr(string, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.warncorr_system.string-system.exception-system.string___1kh0i9m) | public abstract | Writes the diagnostic message at the `Warn` level with correlation ID. | - | [WarnCorr(string, string)](#m-net.adamec.lib.common.logging.ilogger.warncorr_system.string-system.string___pr2tiu) | public abstract | Writes the diagnostic message at the `Warn` level with correlation ID. | + | [ServiceCollectionConfigureDirectException()](#m-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception.-ctor__1n8hr1d) | public | Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) | + | [ServiceCollectionConfigureDirectException(string)](#m-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception.-ctor_system.string___1dp1v34) | public | Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) | + | [ServiceCollectionConfigureDirectException(string, Exception)](#m-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception.-ctor_system.string-system.exception___1uv85c8) | public | Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) | @@ -5253,102 +1945,84 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.Debug(Dictionary<string,object>, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ServiceCollectionConfigureDirectException.ServiceCollectionConfigureDirectException() Constructor ## +Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) +Sources: di\config\exception\ServiceCollectionConfigureDirectException.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Debug` level. +Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) ```csharp -public abstract void Debug(Dictionary eventProperties, [Localizable(false)] string message) +public ServiceCollectionConfigureDirectException() ``` -Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-Return value
void
- - Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## ILogger.DebugCorr(string, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ServiceCollectionConfigureDirectException.ServiceCollectionConfigureDirectException(string) Constructor ## +Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) +Sources: di\config\exception\ServiceCollectionConfigureDirectException.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Debug` level with correlation ID. +Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) ```csharp -public abstract void DebugCorr(string correlationId, [Localizable(false)] string message) +public ServiceCollectionConfigureDirectException(string message) ``` -Method parameters
string correlationId
Correlation ID
string message
Log message.
-Return value
void
- - +Constructor parameters
string message
Error message
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## ILogger.Error(Dictionary<string,object>, Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ServiceCollectionConfigureDirectException.ServiceCollectionConfigureDirectException(string, Exception) Constructor ## +Namespace: [net.adamec.lib.common.di.config.exception](#n-net.adamec.lib.common.di.config.exception__15nr03q) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) +Sources: di\config\exception\ServiceCollectionConfigureDirectException.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Error` level. +Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj) ```csharp -public abstract void Error(Dictionary eventProperties, Exception exception, [Localizable(false)] string message) +public ServiceCollectionConfigureDirectException(string message, Exception inner) ``` -Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
void
- - +Constructor parameters
string message
Error message
System.Exception inner
Inner exception
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## ILogger.Error(Dictionary<string,object>, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Error` level. - - +## net.adamec.lib.common.di.config.extensions Namespace ## +### Classes ### -```csharp -public abstract void Error(Dictionary eventProperties, [Localizable(false)] string message) -``` + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.config.extensions.containerbuilderextensions__tpisv7) | internal static | Autofac Autofac.ContainerBuilder extensions | + | [ServiceCollectionAutoOptionsExtension](#t-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension__1p9fgao) | internal static | Extensions for options (configuration) class automatic binding to appsettings.json | + | [ServiceCollectionConfigureDirectExtensions](#t-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions__wdwckv) | internal static | Extensions for options (configuration) class registration into MS DI | -Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-Return value
void
+ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5357,51 +2031,34 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.Error<TException>(string, Exception) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ContainerBuilderExtensions Class ## +Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.ExceptionPassThrough.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Sources: di\config\extensions\ContainerBuilderExtensions.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Error` level. Creates and returns the exception of given type +Autofac Autofac.ContainerBuilder extensions ```csharp -public abstract ILogger.TException Error(string message, Exception innerException = null) where TException: Exception +internal static class ContainerBuilderExtensions ``` -Type parameters
TException
-Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
-Return value
net.adamec.lib.common.logging.ILogger.TException
Created exception
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - -## ILogger.ErrorCorr(string, Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - +Inheritance: object -Writes the diagnostic message at the `Error` level with correlation ID. +### Methods ### -```csharp -public abstract void ErrorCorr(string correlationId, Exception exception, [Localizable(false)] string message) -``` + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [AddAutoOptions(ContainerBuilder, IConfigurationRoot, Assembly[])](#m-net.adamec.lib.common.di.config.extensions.containerbuilderextensions.addautooptions_autofac.containerbuilder-microsoft.extensions.configuration.iconfigurationroot-system.reflection.assembly_____pfqod1) | public static | Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions | + | [AddAutoOptions(ContainerBuilder, IConfigurationRoot, Type[])](#m-net.adamec.lib.common.di.config.extensions.containerbuilderextensions.addautooptions_autofac.containerbuilder-microsoft.extensions.configuration.iconfigurationroot-system.type_____1fbl63e) | public static | Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions | + | [AddOptions<TOptions>(ContainerBuilder, IConfigurationRoot, string)](#m-net.adamec.lib.common.di.config.extensions.containerbuilderextensions.addoptions--1_autofac.containerbuilder-microsoft.extensions.configuration.iconfigurationroot-system.string___1b2rpkf) | public static | Creates and registers the singleton of configuration (options) class of given type This is to be used if not registered using the [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) | -Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
void
+ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5410,51 +2067,58 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.ErrorCorr(string, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ContainerBuilderExtensions.AddAutoOptions(ContainerBuilder, IConfigurationRoot, Assembly[]) Method ## +Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.config.extensions.containerbuilderextensions__tpisv7) +Sources: di\config\extensions\ContainerBuilderExtensions.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Error` level with correlation ID. +Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions ```csharp -public abstract void ErrorCorr(string correlationId, [Localizable(false)] string message) +public static void AddAutoOptions(this ContainerBuilder builder, IConfigurationRoot configuration, params Assembly[] assemblies) ``` -Method parameters
string correlationId
Correlation ID
string message
Log message.
+Method parameters
Autofac.ContainerBuilder builder
AutoFac container builder
Microsoft.Extensions.Configuration.IConfigurationRoot configuration
Configuration container
System.Reflection.Assembly[] assemblies
Assemblies to check
Return value
void
+### Exceptions ### +
System.ArgumentNullException
configuration or assemblies is null
+ + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## ILogger.ErrorCorr<TException>(string, ILogger.TException, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ContainerBuilderExtensions.AddAutoOptions(ContainerBuilder, IConfigurationRoot, Type[]) Method ## +Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.config.extensions.containerbuilderextensions__tpisv7) +Sources: di\config\extensions\ContainerBuilderExtensions.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Error` level and returns the exception of given type +Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions ```csharp -public abstract ILogger.TException ErrorCorr(string correlationId, ILogger.TException exception, string message = null) where TException: Exception +public static void AddAutoOptions(this ContainerBuilder builder, IConfigurationRoot configuration, params Type[] types) ``` -Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
-Return value
net.adamec.lib.common.logging.ILogger.TException
Pass-through exception
+Method parameters
Autofac.ContainerBuilder builder
AutoFac container builder
Microsoft.Extensions.Configuration.IConfigurationRoot configuration
Configuration container
System.Type[] types
Types to check
+Return value
void
+ + +### Exceptions ### +
System.ArgumentNullException
configuration or types is null
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5463,25 +2127,29 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.ErrorCorr<TException>(string, string, Exception) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ContainerBuilderExtensions.AddOptions<TOptions>(ContainerBuilder, IConfigurationRoot, string) Method ## +Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.config.extensions.containerbuilderextensions__tpisv7) +Sources: di\config\extensions\ContainerBuilderExtensions.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Error` level with correlation ID. Creates and returns the exception of given type +Creates and registers the singleton of configuration (options) class of given type This is to be used if not registered using the [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) ```csharp -public abstract ILogger.TException ErrorCorr(string correlationId, string message, Exception innerException = null) where TException: Exception +public static void AddOptions(this ContainerBuilder builder, IConfigurationRoot configuration, string configSection) where TOptions: new() ``` -Type parameters
TException
-Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
-Return value
net.adamec.lib.common.logging.ILogger.TException
Created exception
+Type parameters
TOptions
Configuration class type
+Method parameters
Autofac.ContainerBuilder builder
AutoFac container builder
Microsoft.Extensions.Configuration.IConfigurationRoot configuration
Configuration container
string configSection
Name of the configuration section to bind to
+Return value
void
+ + +### Exceptions ### +
System.ArgumentNullException
configuration is null
System.ArgumentException
configSection is null or empty
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5490,50 +2158,33 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.ErrorFltr<TException>(ILogger.TException, string, bool) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ServiceCollectionAutoOptionsExtension Class ## +Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.ExceptionFilter.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Sources: di\config\extensions\ServiceCollectionAutoOptionsExtension.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Error` level and returns the exception of given type +Extensions for options (configuration) class automatic binding to appsettings.json ```csharp -public abstract bool ErrorFltr(ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception +internal static class ServiceCollectionAutoOptionsExtension ``` -Type parameters
TException
-Method parameters
net.adamec.lib.common.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-Return value
bool
Flag whether the exception is to be catch by exception filter
+Inheritance: object -### Example ### -The following code logs any exception without catching it (function returns false by default) -```csharp - try - { - ... - } - catch (Exception e) when (Logger.FatalFltr(e)) {} -``` - The following code catch and log the ArgumentException and logs any other exception without catching it. -```csharp - try - { - ... - } - catch (ArgumentException e) when (Logger.ErrorFltr(e,catchIt:true)) {} - catch (Exception e) when (Logger.FatalFltr(e)) {} -``` +### Methods ### + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [ConfigureAutoOptions(IServiceCollection, IConfiguration, Assembly[])](#m-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension.configureautooptions_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration-system.reflection.assembly_____bfjrc2) | public static | Scans given assemblies for classes marked with [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI | + | [ConfigureAutoOptions(IServiceCollection, IConfigurationRoot, Assembly[])](#m-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension.configureautooptions_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfigurationroot-system.reflection.assembly_____1kc5g1y) | public static | Scans given assemblies for classes marked with [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI | -### Remarks ### -This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5542,33 +2193,28 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.ErrorFltrCorr<TException>(string, ILogger.TException, string, bool) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ServiceCollectionAutoOptionsExtension.ConfigureAutoOptions(IServiceCollection, IConfiguration, Assembly[]) Method ## +Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ServiceCollectionAutoOptionsExtension](#t-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension__1p9fgao) +Sources: di\config\extensions\ServiceCollectionAutoOptionsExtension.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Error` level and returns the exception of given type +Scans given assemblies for classes marked with [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI ```csharp -public abstract bool ErrorFltrCorr(string correlationId, ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception +public static IServiceCollection ConfigureAutoOptions(this IServiceCollection services, IConfiguration configuration, Assembly[] assemblies) ``` -Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-Return value
bool
Flag whether the exception is to be catch by exception filter
- - -### Remarks ### -This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) +Method parameters
Microsoft.Extensions.DependencyInjection.IServiceCollection services
Service collection
Microsoft.Extensions.Configuration.IConfiguration configuration
Configuration
System.Reflection.Assembly[] assemblies
Assemblies to scan
+Return value
Microsoft.Extensions.DependencyInjection.IServiceCollection
Service collection
-### See Also ### -[ErrorFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.logging.ilogger.errorfltr--1_--0-system.string-system.boolean___135nosm) +### Exceptions ### +
System.ArgumentNullException
services or assemblies is `null`
[ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
Can get 'services.Configure' method
[ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
Can't invoke 'services.Configure<type>(section)'
[ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj)
Can't create the instance of options (configuration) class
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5577,24 +2223,28 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.ErrorPassThrough(Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ServiceCollectionAutoOptionsExtension.ConfigureAutoOptions(IServiceCollection, IConfigurationRoot, Assembly[]) Method ## +Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.ExceptionPassThrough.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ServiceCollectionAutoOptionsExtension](#t-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension__1p9fgao) +Sources: di\config\extensions\ServiceCollectionAutoOptionsExtension.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Error` level and returns given exception +Scans given assemblies for classes marked with [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI ```csharp -public abstract Exception ErrorPassThrough(Exception exception, string message = null) +public static IServiceCollection ConfigureAutoOptions(this IServiceCollection services, IConfigurationRoot configuration, Assembly[] assemblies) ``` -Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
System.Exception
Pass-through exception
+Method parameters
Microsoft.Extensions.DependencyInjection.IServiceCollection services
Service collection
Microsoft.Extensions.Configuration.IConfigurationRoot configuration
Configuration root
System.Reflection.Assembly[] assemblies
Assemblies to scan
+Return value
Microsoft.Extensions.DependencyInjection.IServiceCollection
Service collection
+ + +### Exceptions ### +
System.ArgumentNullException
services or assemblies is `null`
[ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
Can get 'services.Configure' method
[ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
Can't invoke 'services.Configure<type>(section)'
[ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj)
Can't create the instance of options (configuration) class
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5603,24 +2253,35 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.Fatal(Dictionary<string,object>, Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ServiceCollectionConfigureDirectExtensions Class ## +Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Sources: di\config\extensions\ServiceCollectionConfigureDirectExtensions.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) + + +Extensions for options (configuration) class registration into MS DI + + + +```csharp +internal static class ServiceCollectionConfigureDirectExtensions +``` +Inheritance: object -Writes the diagnostic message at the `Fatal` level. +### Methods ### -```csharp -public abstract void Fatal(Dictionary eventProperties, Exception exception, [Localizable(false)] string message) -``` + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [ConfigureDirect(IServiceCollection, Type, IConfiguration)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect_microsoft.extensions.dependencyinjection.iservicecollection-system.type-microsoft.extensions.configuration.iconfiguration___1lbalbi) | public static | Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI. | + | [ConfigureDirect<TConfig>(IServiceCollection, IConfiguration)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect--1_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration___1049ily) | public static | Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI. | + | [ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, Func<TConfig>)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect--1_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration-system.func_--0____1uka1kl) | public static | Gets the instance of the options (configuration) class from pocoProvider , binds (fills) it to the configuration and registers is as singleton into MS DI. | + | [ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, ServiceCollectionConfigureDirectExtensions.TConfig)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect--1_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration---0___18sq65m) | public static | Binds (fills) given instance of the options (configuration) class to configuration and registers is as singleton into MS DI. | -Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
void
+ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5629,24 +2290,28 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.Fatal(Dictionary<string,object>, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ServiceCollectionConfigureDirectExtensions.ConfigureDirect(IServiceCollection, Type, IConfiguration) Method ## +Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ServiceCollectionConfigureDirectExtensions](#t-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions__wdwckv) +Sources: di\config\extensions\ServiceCollectionConfigureDirectExtensions.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Fatal` level. +Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI. ```csharp -public abstract void Fatal(Dictionary eventProperties, [Localizable(false)] string message) +public static object ConfigureDirect(this IServiceCollection services, Type type, IConfiguration configuration) ``` -Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-Return value
void
+Method parameters
Microsoft.Extensions.DependencyInjection.IServiceCollection services
MS DI Service collection
System.Type type
Type of options (configuration) class to register as singleton
Microsoft.Extensions.Configuration.IConfiguration configuration
+Return value
object
Options (configuration) class instance registered as singleton
+ + +### Exceptions ### +
System.ArgumentNullException
services or configuration is `null`
[ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj)
Can't create the instance of options (configuration) class
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5655,25 +2320,29 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.Fatal<TException>(string, Exception) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ServiceCollectionConfigureDirectExtensions.ConfigureDirect<TConfig>(IServiceCollection, IConfiguration) Method ## +Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.ExceptionPassThrough.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ServiceCollectionConfigureDirectExtensions](#t-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions__wdwckv) +Sources: di\config\extensions\ServiceCollectionConfigureDirectExtensions.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Fatal` level. Creates and returns the exception of given type +Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI. ```csharp -public abstract ILogger.TException Fatal(string message, Exception innerException = null) where TException: Exception +public static ServiceCollectionConfigureDirectExtensions.TConfig ConfigureDirect(this IServiceCollection services, IConfiguration configuration) where TConfig: class, new() ``` -Type parameters
TException
-Method parameters
string message
Log message.
System.Exception innerException
Exception to be logged
-Return value
net.adamec.lib.common.logging.ILogger.TException
Created exception
+Type parameters
TConfig
Type of options (configuration) class to register as singleton
+Method parameters
Microsoft.Extensions.DependencyInjection.IServiceCollection services
MS DI Service collection
Microsoft.Extensions.Configuration.IConfiguration configuration
Configuration (data) to be filled into the options class instance
+Return value
net.adamec.lib.common.di.config.extensions.ServiceCollectionConfigureDirectExtensions.TConfig
Options (configuration) class instance registered as singleton
+ + +### Exceptions ### +
System.ArgumentNullException
services or configuration is `null`
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5682,24 +2351,29 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.FatalCorr(string, Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ServiceCollectionConfigureDirectExtensions.ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, Func<TConfig>) Method ## +Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ServiceCollectionConfigureDirectExtensions](#t-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions__wdwckv) +Sources: di\config\extensions\ServiceCollectionConfigureDirectExtensions.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Fatal` level with correlation ID. +Gets the instance of the options (configuration) class from pocoProvider , binds (fills) it to the configuration and registers is as singleton into MS DI. ```csharp -public abstract void FatalCorr(string correlationId, Exception exception, [Localizable(false)] string message) +public static ServiceCollectionConfigureDirectExtensions.TConfig ConfigureDirect(this IServiceCollection services, IConfiguration configuration, Func pocoProvider) where TConfig: class ``` -Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
void
+Type parameters
TConfig
Type of options (configuration) class to register as singleton
+Method parameters
Microsoft.Extensions.DependencyInjection.IServiceCollection services
MS DI Service collection
Microsoft.Extensions.Configuration.IConfiguration configuration
Configuration (data) to be filled into the options class instance
System.Func<TConfig> pocoProvider
Delegate of function that will provide the options (configuration) class instance
+Return value
net.adamec.lib.common.di.config.extensions.ServiceCollectionConfigureDirectExtensions.TConfig
Options (configuration) class instance registered as singleton
+ + +### Exceptions ### +
System.ArgumentNullException
One of the parameters is `null`
System.Exception
A delegate callback throws an exception.
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5708,51 +2382,46 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.FatalCorr(string, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ServiceCollectionConfigureDirectExtensions.ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, ServiceCollectionConfigureDirectExtensions.TConfig) Method ## +Namespace: [net.adamec.lib.common.di.config.extensions](#n-net.adamec.lib.common.di.config.extensions__1bjxl1v) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ServiceCollectionConfigureDirectExtensions](#t-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions__wdwckv) +Sources: di\config\extensions\ServiceCollectionConfigureDirectExtensions.cs +Source-only packages: [RadCommons.di.Config](#src-only-package--RadCommons.di.Config) -Writes the diagnostic message at the `Fatal` level with correlation ID. +Binds (fills) given instance of the options (configuration) class to configuration and registers is as singleton into MS DI. ```csharp -public abstract void FatalCorr(string correlationId, [Localizable(false)] string message) +public static ServiceCollectionConfigureDirectExtensions.TConfig ConfigureDirect(this IServiceCollection services, IConfiguration configuration, ServiceCollectionConfigureDirectExtensions.TConfig config) where TConfig: class ``` -Method parameters
string correlationId
Correlation ID
string message
Log message.
-Return value
void
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) +Type parameters
TConfig
Type of options (configuration) class to register as singleton
+Method parameters
Microsoft.Extensions.DependencyInjection.IServiceCollection services
MS DI Service collection
Microsoft.Extensions.Configuration.IConfiguration configuration
Configuration (data) to be filled into the options class instance
net.adamec.lib.common.di.config.extensions.ServiceCollectionConfigureDirectExtensions.TConfig config
+Return value
net.adamec.lib.common.di.config.extensions.ServiceCollectionConfigureDirectExtensions.TConfig
Options (configuration) class instance registered as singleton
- +### Exceptions ### +
System.ArgumentNullException
One of the parameters is `null`
-## ILogger.FatalCorr<TException>(string, ILogger.TException, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -Writes the diagnostic message at the `Fatal` level and returns the exception of given type + +## net.adamec.lib.common.di.postinit Namespace ## +### Classes ### -```csharp -public abstract ILogger.TException FatalCorr(string correlationId, ILogger.TException exception, string message = null) where TException: Exception -``` + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.postinit.containerbuilderextensions__7mjuw3) | internal static | Autofac Autofac.ContainerBuilder extensions | + | [PostInitAttribute](#t-net.adamec.lib.common.di.postinit.postinitattribute__qimmrl) | public | Allows to run post init method of component. Component must be registered using the Component attribute as singleton in root scope and must register self Parameters of "marked" post init method are resolved from container (throws an exception on failure) | -Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
-Return value
net.adamec.lib.common.logging.ILogger.TException
Pass-through exception
+ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5761,25 +2430,33 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.FatalCorr<TException>(string, string, Exception) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ContainerBuilderExtensions Class ## +Namespace: [net.adamec.lib.common.di.postinit](#n-net.adamec.lib.common.di.postinit__ylne5f) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Sources: di\postinit\ContainerBuilderExtensions.cs +Source-only packages: [RadCommons.di.PostInit](#src-only-package--RadCommons.di.PostInit) -Writes the diagnostic message at the `Fatal` level with correlation ID. Creates and returns the exception of given type +Autofac Autofac.ContainerBuilder extensions ```csharp -public abstract ILogger.TException FatalCorr(string correlationId, string message, Exception innerException = null) where TException: Exception +internal static class ContainerBuilderExtensions ``` -Type parameters
TException
-Method parameters
string correlationId
Correlation ID
string message
Log message.
System.Exception innerException
Exception to be logged
-Return value
net.adamec.lib.common.logging.ILogger.TException
Created exception
+Inheritance: object + + + +### Methods ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [AddComponentPostInitSupport(ContainerBuilder)](#m-net.adamec.lib.common.di.postinit.containerbuilderextensions.addcomponentpostinitsupport_autofac.containerbuilder___nsekfd) | public static | Adds the support of [PostInitAttribute](#t-net.adamec.lib.common.di.postinit.postinitattribute__qimmrl) to the Autofac container builder. | + | [ProcessComponentPostInit(IContainer)](#m-net.adamec.lib.common.di.postinit.containerbuilderextensions.processcomponentpostinit_autofac.icontainer___uo3mji) | private static | Executes the components' post init methods | + + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5788,33 +2465,28 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.FatalFltr<TException>(ILogger.TException, string, bool) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ContainerBuilderExtensions.AddComponentPostInitSupport(ContainerBuilder) Method ## +Namespace: [net.adamec.lib.common.di.postinit](#n-net.adamec.lib.common.di.postinit__ylne5f) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.ExceptionFilter.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.postinit.containerbuilderextensions__7mjuw3) +Sources: di\postinit\ContainerBuilderExtensions.cs +Source-only packages: [RadCommons.di.PostInit](#src-only-package--RadCommons.di.PostInit) -Writes the diagnostic message at the `Fatal` level and returns catchIt value. +Adds the support of [PostInitAttribute](#t-net.adamec.lib.common.di.postinit.postinitattribute__qimmrl) to the Autofac container builder. ```csharp -public abstract bool FatalFltr(ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception +public static ContainerBuilder AddComponentPostInitSupport(this ContainerBuilder builder) ``` -Type parameters
TException
-Method parameters
net.adamec.lib.common.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-Return value
bool
Flag whether the exception is to be catch by exception filter
+Method parameters
Autofac.ContainerBuilder builder
+Return value
Autofac.ContainerBuilder
Autofac container builder
### Remarks ### -This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) - - -### See Also ### -[ErrorFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.logging.ilogger.errorfltr--1_--0-system.string-system.boolean___135nosm) +Registers the [ProcessComponentPostInit(IContainer)](#m-net.adamec.lib.common.di.postinit.containerbuilderextensions.processcomponentpostinit_autofac.icontainer___uo3mji) method as a container-built-callback Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5823,33 +2495,32 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.FatalFltrCorr<TException>(string, ILogger.TException, string, bool) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ContainerBuilderExtensions.ProcessComponentPostInit(IContainer) Method ## +Namespace: [net.adamec.lib.common.di.postinit](#n-net.adamec.lib.common.di.postinit__ylne5f) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ContainerBuilderExtensions](#t-net.adamec.lib.common.di.postinit.containerbuilderextensions__7mjuw3) +Sources: di\postinit\ContainerBuilderExtensions.cs +Source-only packages: [RadCommons.di.PostInit](#src-only-package--RadCommons.di.PostInit) -Writes the diagnostic message at the `Fatal` level and returns catchIt value. +Executes the components' post init methods ```csharp -public abstract bool FatalFltrCorr(string correlationId, ILogger.TException exception, string message = null, bool catchIt = false) where TException: Exception +private static void ProcessComponentPostInit(IContainer container) ``` -Type parameters
TException
-Method parameters
string correlationId
Correlation ID
net.adamec.lib.common.logging.ILogger.TException exception
Exception to be logged
string message
Log message.
bool catchIt
Flag whether the exception is to be catch by filter (default is false)
-Return value
bool
Flag whether the exception is to be catch by exception filter
+Method parameters
Autofac.IContainer container
+Return value
void
### Remarks ### -This function is intended for catch exception filters. The parameter catchIt defines whether the exception filter will be applied after logging. The exception will be catch when catchIt is true, otherwise the filter is evaluated as false and it will continue with finding the catch clause (in both cases the log entry will be created) +Checks Autofac registry for the services with [ComponentAttribute](#t-net.adamec.lib.common.di.component.componentattribute__170qqzl) that register themselves (so the interface registrations are excluded). For such components (services) it tries to find the methods marked with [PostInitAttribute](#t-net.adamec.lib.common.di.postinit.postinitattribute__qimmrl) and execute them. When the method has the parameters, it will try to resolve the from the container -### See Also ### -[ErrorFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.logging.ilogger.errorfltr--1_--0-system.string-system.boolean___135nosm) +### Exceptions ### +
System.Exception
Can't resolve the post init method parameter from container or can't get the component instance from container
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5858,24 +2529,25 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.FatalPassThrough(Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## PostInitAttribute Class ## +Namespace: [net.adamec.lib.common.di.postinit](#n-net.adamec.lib.common.di.postinit__ylne5f) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.ExceptionPassThrough.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Sources: di\postinit\PostInitAttribute.cs +Source-only packages: [RadCommons.di.PostInit](#src-only-package--RadCommons.di.PostInit) -Writes the diagnostic message at the `Fatal` level and returns given exception +Allows to run post init method of component. Component must be registered using the Component attribute as singleton in root scope and must register self Parameters of "marked" post init method are resolved from container (throws an exception on failure) ```csharp -public abstract Exception FatalPassThrough(Exception exception, string message = null) +[AttributeUsage(System.AttributeTargets.Method, AllowMultiple = false)] +public class PostInitAttribute : Attribute ``` -Method parameters
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
System.Exception
Pass-through exception
+Inheritance: object -> Attribute +Attributes: System.AttributeUsageAttribute + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5884,24 +2556,18 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.Info(Dictionary<string,object>, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) -Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) - - -Writes the diagnostic message at the `Info` level. - - +## net.adamec.lib.common.extensions Namespace ## +### Classes ### -```csharp -public abstract void Info(Dictionary eventProperties, [Localizable(false)] string message) -``` + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [ArrayExtensions](#t-net.adamec.lib.common.extensions.arrayextensions__icw7wf) | internal static | Array extensions | + | [EnumeratorExtensions](#t-net.adamec.lib.common.extensions.enumeratorextensions__obwbb2) | internal static | System.Collections.Generic.IEnumerator`1 class extensions | + | [IEnumerableExtensions](#t-net.adamec.lib.common.extensions.ienumerableextensions__1a6urvh) | internal static | System.Collections.Generic.IEnumerable`1 extensions | + | [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) | internal static | System.String class extensions | + | [TypeExtensions](#t-net.adamec.lib.common.extensions.typeextensions__63ezc8) | internal static | System.Type extensions | -Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-Return value
void
+ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5910,24 +2576,33 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.InfoCorr(string, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ArrayExtensions Class ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Sources: extensions\ArrayExtensionsAppendBytes.cs, extensions\ArrayExtensionsFill.cs +Source-only packages: [RadCommons.extensions.ArrayExtensions.ConcatenateBytes](#src-only-package--RadCommons.extensions.ArrayExtensions.ConcatenateBytes), [RadCommons.extensions.ArrayExtensions.Fill](#src-only-package--RadCommons.extensions.ArrayExtensions.Fill) -Writes the diagnostic message at the `Info` level with correlation ID. +Array extensions ```csharp -public abstract void InfoCorr(string correlationId, [Localizable(false)] string message) +internal static class ArrayExtensions ``` -Method parameters
string correlationId
Correlation ID
string message
Log message.
-Return value
void
+Inheritance: object + + + +### Methods ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [AppendBytes(byte[], byte[])](#m-net.adamec.lib.common.extensions.arrayextensions.appendbytes_system.byte__-system.byte_____1lkijjg) | public static | Adds the byte array to the current one and returns resulting array (concatenates two byte arrays into a new one) | + | [Fill<T>(ArrayExtensions.T[], ArrayExtensions.T)](#m-net.adamec.lib.common.extensions.arrayextensions.fill--1_--0__---0___6j19g1) | public static | Fills the array or T with defaultValue | + + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5936,24 +2611,24 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.Trace(Dictionary<string,object>, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ArrayExtensions.AppendBytes(byte[], byte[]) Method ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ArrayExtensions](#t-net.adamec.lib.common.extensions.arrayextensions__icw7wf) +Sources: extensions\ArrayExtensionsAppendBytes.cs +Source-only packages: [RadCommons.extensions.ArrayExtensions.ConcatenateBytes](#src-only-package--RadCommons.extensions.ArrayExtensions.ConcatenateBytes) -Writes the diagnostic message at the `Trace` level. +Adds the byte array to the current one and returns resulting array (concatenates two byte arrays into a new one) ```csharp -public abstract void Trace(Dictionary eventProperties, [Localizable(false)] string message) +public static byte[] AppendBytes(this byte[] original, byte[] addedBytes) ``` -Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-Return value
void
+Method parameters
byte[] original
Original byte array
byte[] addedBytes
Bytes to add
+Return value
byte[]
New concatenated byte array ( original + addedBytes )
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -5962,23 +2637,24 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.TraceCorr(string, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## ArrayExtensions.Fill<T>(ArrayExtensions.T[], ArrayExtensions.T) Method ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [ArrayExtensions](#t-net.adamec.lib.common.extensions.arrayextensions__icw7wf) +Sources: extensions\ArrayExtensionsFill.cs +Source-only packages: [RadCommons.extensions.ArrayExtensions.Fill](#src-only-package--RadCommons.extensions.ArrayExtensions.Fill) -Writes the diagnostic message at the `Trace` level with correlation ID. +Fills the array or T with defaultValue ```csharp -public abstract void TraceCorr(string correlationId, [Localizable(false)] string message) +public static void Fill(this ArrayExtensions.T[] array, ArrayExtensions.T defaultValue) ``` -Method parameters
string correlationId
Correlation ID
string message
Log message.
+Type parameters
T
array item type
+Method parameters
net.adamec.lib.common.extensions.ArrayExtensions.T[] array
Array to fill
net.adamec.lib.common.extensions.ArrayExtensions.T defaultValue
Value to fill the array with
Return value
void
@@ -5988,24 +2664,34 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.Warn(Dictionary<string,object>, Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## EnumeratorExtensions Class ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Sources: extensions\EnumeratorExtensionsToEnumerable.cs +Source-only packages: [RadCommons.extensions.EnumeratorExtensions.ToEnumerable](#src-only-package--RadCommons.extensions.EnumeratorExtensions.ToEnumerable) -Writes the diagnostic message at the `Warn` level. +System.Collections.Generic.IEnumerator`1 class extensions ```csharp -public abstract void Warn(Dictionary eventProperties, Exception exception, [Localizable(false)] string message) +internal static class EnumeratorExtensions ``` -Method parameters
Dictionary<string,object> eventProperties
Event properties
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
void
+Inheritance: object + + + +### Methods ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [ToEnumerable<T>(IEnumerator)](#m-net.adamec.lib.common.extensions.enumeratorextensions.toenumerable--1_system.collections.ienumerator___fs1sul) | public static | Transforms the enumerator to System.Collections.Generic.IEnumerable`1 | + | [ToEnumerable<T>(IEnumerator<T>)](#m-net.adamec.lib.common.extensions.enumeratorextensions.toenumerable--1_system.collections.generic.ienumerator_--0____1e4iyhs) | public static | Transforms the enumerator to System.Collections.Generic.IEnumerable`1 | + | [ToList<T>(IEnumerator)](#m-net.adamec.lib.common.extensions.enumeratorextensions.tolist--1_system.collections.ienumerator___lgcqeh) | public static | Transforms the enumerator to System.Collections.Generic.List`1 | + + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6014,24 +2700,29 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.Warn(Dictionary<string,object>, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## EnumeratorExtensions.ToEnumerable<T>(IEnumerator) Method ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.EventProperties.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [EnumeratorExtensions](#t-net.adamec.lib.common.extensions.enumeratorextensions__obwbb2) +Sources: extensions\EnumeratorExtensionsToEnumerable.cs +Source-only packages: [RadCommons.extensions.EnumeratorExtensions.ToEnumerable](#src-only-package--RadCommons.extensions.EnumeratorExtensions.ToEnumerable) -Writes the diagnostic message at the `Warn` level. +Transforms the enumerator to System.Collections.Generic.IEnumerable`1 ```csharp -public abstract void Warn(Dictionary eventProperties, [Localizable(false)] string message) +public static IEnumerable ToEnumerable(this IEnumerator enumerator) ``` -Method parameters
Dictionary<string,object> eventProperties
Event properties
string message
Log message.
-Return value
void
+Type parameters
T
Type of objects held in enumerator/enumerable
+Method parameters
IEnumerator enumerator
Enumerator to transforms
+Return value
IEnumerable<T>
System.Collections.Generic.IEnumerable`1 based on given enumerator
+ + +### Exceptions ### +
System.ArgumentNullException
enumerator is null
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6040,24 +2731,29 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.WarnCorr(string, Exception, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## EnumeratorExtensions.ToEnumerable<T>(IEnumerator<T>) Method ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [EnumeratorExtensions](#t-net.adamec.lib.common.extensions.enumeratorextensions__obwbb2) +Sources: extensions\EnumeratorExtensionsToEnumerable.cs +Source-only packages: [RadCommons.extensions.EnumeratorExtensions.ToEnumerable](#src-only-package--RadCommons.extensions.EnumeratorExtensions.ToEnumerable) -Writes the diagnostic message at the `Warn` level with correlation ID. +Transforms the enumerator to System.Collections.Generic.IEnumerable`1 ```csharp -public abstract void WarnCorr(string correlationId, Exception exception, [Localizable(false)] string message) +public static IEnumerable ToEnumerable(this IEnumerator enumerator) ``` -Method parameters
string correlationId
Correlation ID
System.Exception exception
Exception to be logged
string message
Log message.
-Return value
void
+Type parameters
T
Type of objects held in enumerator/enumerable
+Method parameters
IEnumerator<T> enumerator
Enumerator to transforms
+Return value
IEnumerable<T>
System.Collections.Generic.IEnumerable`1 based on given enumerator
+ + +### Exceptions ### +
System.ArgumentNullException
enumerator is null
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6066,24 +2762,29 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## ILogger.WarnCorr(string, string) Method ## -Namespace: [net.adamec.lib.common.logging](#n-net.adamec.lib.common.logging__1g9pm29) +## EnumeratorExtensions.ToList<T>(IEnumerator) Method ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Type: [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) -Sources: logging\ILogger.CorrelationId.cs -Source-only packages: [RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging) +Type: [EnumeratorExtensions](#t-net.adamec.lib.common.extensions.enumeratorextensions__obwbb2) +Sources: extensions\EnumeratorExtensionsToEnumerable.cs +Source-only packages: [RadCommons.extensions.EnumeratorExtensions.ToEnumerable](#src-only-package--RadCommons.extensions.EnumeratorExtensions.ToEnumerable) -Writes the diagnostic message at the `Warn` level with correlation ID. +Transforms the enumerator to System.Collections.Generic.List`1 ```csharp -public abstract void WarnCorr(string correlationId, [Localizable(false)] string message) +public static List ToList(this IEnumerator enumerator) ``` -Method parameters
string correlationId
Correlation ID
string message
Log message.
-Return value
void
+Type parameters
T
Type of objects held in enumerator/list
+Method parameters
IEnumerator enumerator
Enumerator to transforms
+Return value
List<T>
System.Collections.Generic.List`1 based on given enumerator
+ + +### Exceptions ### +
System.ArgumentNullException
enumerator is null
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6092,43 +2793,30 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## net.adamec.lib.common.utils Namespace ## -### Classes ### +## IEnumerableExtensions Class ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) +Assembly: net.adamec.lib.common +Sources: extensions\IEnumerableExtensionsForEach.cs +Source-only packages: [RadCommons.extensions.IEnumerableExtensions.ForEach](#src-only-package--RadCommons.extensions.IEnumerableExtensions.ForEach) - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) | public | Executes an operation on a separate thread with possibility of sync cancel. | - | [BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) | public abstract | Helper class for implementation of System.IDisposable types | - | [ConsoleUtils](#t-net.adamec.lib.common.utils.consoleutils__8nc415) | internal static | Console output helpers | - | [Context<TState>](#t-net.adamec.lib.common.utils.context-1__15rsz3v) | internal | Base context implementation. | - | [Disposer](#t-net.adamec.lib.common.utils.disposer__1ejr99q) | internal | Keeps the stack of disposable objects, and disposes them when the disposer is being disposed. | - | [FileUtils](#t-net.adamec.lib.common.utils.fileutils__1bi9r8y) | internal static | File copy utilities | - | [MarshalExt](#t-net.adamec.lib.common.utils.marshalext__7jyavy) | internal static | Marshaling helper methods | - | [PeriodicTask](#t-net.adamec.lib.common.utils.periodictask__1xfynj) | internal static | Helper class allowing to execute periodic (or one time) scheduled action | - | [ProcessEventArgs](#t-net.adamec.lib.common.utils.processeventargs__1gw60ix) | public | The ProcessEventArgs are arguments for a console event. | - | [ProcessUtils](#t-net.adamec.lib.common.utils.processutils__tzt3e1) | internal static | System.Diagnostics.Process related utilities | - | [ProcessWrapper](#t-net.adamec.lib.common.utils.processwrapper__1oqe83p) | public | A class the wraps a process, allowing programmatic input and output. | - | [ProcessWrapper.OutputChunk](#t-net.adamec.lib.common.utils.processwrapper.outputchunk__o3evan) | protected | Internal class to hold the output chunk within the output worker | - | [Scope<TState>](#t-net.adamec.lib.common.utils.scope-1__eepqvi) | internal | Base scope implementation. | - | [Txt](#t-net.adamec.lib.common.utils.txt__1fch6k9) | public | Text builder | - +System.Collections.Generic.IEnumerable`1 extensions -### Interfaces ### - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [IScope<TState>](#t-net.adamec.lib.common.utils.iscope-1__88aydf) | internal abstract | Scope interface. | +```csharp +internal static class IEnumerableExtensions +``` - +Inheritance: object -### Delegates ### + +### Methods ### | Name | Modifier | Summary | | ------ | ---------- | --------- | - | [ProcessEventHandler](#t-net.adamec.lib.common.utils.processeventhandler__8h5v6w) | public | A ProcessEventHandler is a delegate for process output events. | + | [ForEach<T>(IEnumerable<T>, Action<T>)](#m-net.adamec.lib.common.extensions.ienumerableextensions.foreach--1_system.collections.generic.ienumerable_--0_-system.action_--0____nwdpsf) | public static | Invokes action for each item of enumerable | @@ -6139,52 +2827,68 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BackgroundWorkerWithSyncCancel Class ## -Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) +## IEnumerableExtensions.ForEach<T>(IEnumerable<T>, Action<T>) Method ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Sources: utils\BackgroundWorkerWithSyncCancel.cs -Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) +Type: [IEnumerableExtensions](#t-net.adamec.lib.common.extensions.ienumerableextensions__1a6urvh) +Sources: extensions\IEnumerableExtensionsForEach.cs +Source-only packages: [RadCommons.extensions.IEnumerableExtensions.ForEach](#src-only-package--RadCommons.extensions.IEnumerableExtensions.ForEach) -Executes an operation on a separate thread with possibility of sync cancel. +Invokes action for each item of enumerable ```csharp -public class BackgroundWorkerWithSyncCancel : BackgroundWorker +public static void ForEach(this IEnumerable enumerable, Action action) ``` -Inheritance: object -> System.MarshalByRefObject -> System.ComponentModel.Component -> System.ComponentModel.BackgroundWorker -Implements: System.ComponentModel.IComponent, IDisposable +Type parameters
T
Enumerable item type
+Method parameters
IEnumerable<T> enumerable
Enumerable
System.Action<T> action
Action to invoke for each item of enumerable
+Return value
void
-### Fields ### +### Exceptions ### +
System.ArgumentNullException
action is null
+ + +Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [isCancelling](#f-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.iscancelling__14bxgje) | private | Backing field for [IsCancelling](#p-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.iscancelling__1krty8c) | - | [isRunningInternal](#f-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.isrunninginternal__np6hee) | private | Internal flag whether the worker is running its DoWork action | - | [lockObject](#f-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.lockobject__slen4g) | private | Lock object | - | [resetEvent](#f-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.resetevent__7jv5b7) | private | Reset event used to ensure that the work is finished | -### Properties ### +## StringExtensions Class ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) +Assembly: net.adamec.lib.common +Sources: extensions\StringExtensionsCase.cs, extensions\StringExtensionsHtml.cs, extensions\StringExtensionsParts.cs, extensions\StringExtensionsPaths.cs, extensions\StringExtensionsWhitespace.cs +Source-only packages: [RadCommons.extensions.StringExtensions.Case](#src-only-package--RadCommons.extensions.StringExtensions.Case), [RadCommons.extensions.StringExtensions.Html](#src-only-package--RadCommons.extensions.StringExtensions.Html), [RadCommons.extensions.StringExtensions.Parts](#src-only-package--RadCommons.extensions.StringExtensions.Parts), [RadCommons.extensions.StringExtensions.Paths](#src-only-package--RadCommons.extensions.StringExtensions.Paths), [RadCommons.extensions.StringExtensions.Whitespace](#src-only-package--RadCommons.extensions.StringExtensions.Whitespace) - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [IsCancelling](#p-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.iscancelling__1krty8c) | public | Flag whether the worker is cancelling | - +System.String class extensions + + + +```csharp +internal static class StringExtensions +``` + +Inheritance: object + ### Methods ### | Name | Modifier | Summary | | ------ | ---------- | --------- | - | [Cancel()](#m-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.cancel__1p5og1v) | public | Requests cancellation of a pending background operation and wait for cancel to complete | - | [OnDoWork(DoWorkEventArgs)](#m-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.ondowork_system.componentmodel.doworkeventargs___1euewn7) | protected | Raises the System.ComponentModel.BackgroundWorker.DoWork event. | + | [AddPath(string, string)](#m-net.adamec.lib.common.extensions.stringextensions.addpath_system.string-system.string___1m9wwnx) | public static | Adds next path segment to string representing path to the file system | + | [FirstLetterToUpper(string)](#m-net.adamec.lib.common.extensions.stringextensions.firstlettertoupper_system.string___12nwwlc) | public static | Converts the first letter of string to upper case | + | [HtmlDecode(string)](#m-net.adamec.lib.common.extensions.stringextensions.htmldecode_system.string___kajpem) | public static | HTML decodes the string | + | [HtmlEncode(string)](#m-net.adamec.lib.common.extensions.stringextensions.htmlencode_system.string___1ozzgea) | public static | HTML encodes the string | + | [LastPart(string, string)](#m-net.adamec.lib.common.extensions.stringextensions.lastpart_system.string-system.string___t4lkjk) | public static | Returns the part of the string after the last occurence of the separator The result is always trimmed | + | [SplitByFirstSpace(string, string)](#m-net.adamec.lib.common.extensions.stringextensions.splitbyfirstspace_system.string-system.string-___d5xnpu) | public static | Splits the string by first space and returns the "before" part. The "after" part is provided in output parameter rest Both result and rest are trimmed | + | [ToCamelCase(string)](#m-net.adamec.lib.common.extensions.stringextensions.tocamelcase_system.string___xq94l0) | public static | Simple CamelCase converter | + | [TrimAndMergeLines(string)](#m-net.adamec.lib.common.extensions.stringextensions.trimandmergelines_system.string___1371ffr) | public static | "Full" trim of the string - the lines within the string are trimmed and then the lines are merged with the space as a separator (instead of the line break) | @@ -6195,23 +2899,24 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BackgroundWorkerWithSyncCancel.isCancelling Field ## -Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) +## StringExtensions.AddPath(string, string) Method ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Type: [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) -Sources: utils\BackgroundWorkerWithSyncCancel.cs -Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) +Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) +Sources: extensions\StringExtensionsPaths.cs +Source-only packages: [RadCommons.extensions.StringExtensions.Paths](#src-only-package--RadCommons.extensions.StringExtensions.Paths) -Backing field for [IsCancelling](#p-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.iscancelling__1krty8c) +Adds next path segment to string representing path to the file system ```csharp -private bool isCancelling +public static string AddPath(this string str, string nextSegment) ``` -Field value
bool
+Method parameters
string str
String representing path to the file system
string nextSegment
Next path segment
+Return value
string
String representing path to the file system
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6220,23 +2925,24 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BackgroundWorkerWithSyncCancel.isRunningInternal Field ## -Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) +## StringExtensions.FirstLetterToUpper(string) Method ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Type: [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) -Sources: utils\BackgroundWorkerWithSyncCancel.cs -Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) +Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) +Sources: extensions\StringExtensionsCase.cs +Source-only packages: [RadCommons.extensions.StringExtensions.Case](#src-only-package--RadCommons.extensions.StringExtensions.Case) -Internal flag whether the worker is running its DoWork action +Converts the first letter of string to upper case ```csharp -private bool isRunningInternal +public static string FirstLetterToUpper(this string str) ``` -Field value
bool
+Method parameters
string str
String to convert
+Return value
string
String with the first letter in upper case
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6245,23 +2951,24 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BackgroundWorkerWithSyncCancel.lockObject Field ## -Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) +## StringExtensions.HtmlDecode(string) Method ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Type: [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) -Sources: utils\BackgroundWorkerWithSyncCancel.cs -Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) +Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) +Sources: extensions\StringExtensionsHtml.cs +Source-only packages: [RadCommons.extensions.StringExtensions.Html](#src-only-package--RadCommons.extensions.StringExtensions.Html) -Lock object +HTML decodes the string ```csharp -private readonly object lockObject +public static string HtmlDecode(this string str) ``` -Field value
object
+Method parameters
string str
String to decode
+Return value
string
HTML decoded string
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6270,23 +2977,24 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BackgroundWorkerWithSyncCancel.resetEvent Field ## -Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) +## StringExtensions.HtmlEncode(string) Method ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Type: [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) -Sources: utils\BackgroundWorkerWithSyncCancel.cs -Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) +Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) +Sources: extensions\StringExtensionsHtml.cs +Source-only packages: [RadCommons.extensions.StringExtensions.Html](#src-only-package--RadCommons.extensions.StringExtensions.Html) -Reset event used to ensure that the work is finished +HTML encodes the string ```csharp -private readonly AutoResetEvent resetEvent +public static string HtmlEncode(this string str) ``` -Field value
System.Threading.AutoResetEvent
+Method parameters
string str
String to encode
+Return value
string
HTML encoded string
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6295,23 +3003,24 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BackgroundWorkerWithSyncCancel.IsCancelling Property ## -Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) +## StringExtensions.LastPart(string, string) Method ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Type: [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) -Sources: utils\BackgroundWorkerWithSyncCancel.cs -Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) +Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) +Sources: extensions\StringExtensionsParts.cs +Source-only packages: [RadCommons.extensions.StringExtensions.Parts](#src-only-package--RadCommons.extensions.StringExtensions.Parts) -Flag whether the worker is cancelling +Returns the part of the string after the last occurence of the separator The result is always trimmed ```csharp -public bool IsCancelling { get; } +public static string LastPart(this string input, string separator) ``` -Property value
bool
+Method parameters
string input
Input string
string separator
Part separator
+Return value
string
Part of the string after the last occurence of the separator or the input string when no separator detected
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6320,23 +3029,24 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BackgroundWorkerWithSyncCancel.Cancel() Method ## -Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) +## StringExtensions.SplitByFirstSpace(string, string) Method ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Type: [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) -Sources: utils\BackgroundWorkerWithSyncCancel.cs -Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) +Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) +Sources: extensions\StringExtensionsParts.cs +Source-only packages: [RadCommons.extensions.StringExtensions.Parts](#src-only-package--RadCommons.extensions.StringExtensions.Parts) -Requests cancellation of a pending background operation and wait for cancel to complete +Splits the string by first space and returns the "before" part. The "after" part is provided in output parameter rest Both result and rest are trimmed ```csharp -public void Cancel() +public static string SplitByFirstSpace(this string input, out string rest) ``` -Return value
void
+Method parameters
string input
Input string
string rest
The part of string after the first space or null if there is no space
+Return value
string
Part of the string before the first space or the whole string if no space detected
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6345,24 +3055,24 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BackgroundWorkerWithSyncCancel.OnDoWork(DoWorkEventArgs) Method ## -Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) +## StringExtensions.ToCamelCase(string) Method ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Type: [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) -Sources: utils\BackgroundWorkerWithSyncCancel.cs -Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) +Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) +Sources: extensions\StringExtensionsCase.cs +Source-only packages: [RadCommons.extensions.StringExtensions.Case](#src-only-package--RadCommons.extensions.StringExtensions.Case) -Raises the System.ComponentModel.BackgroundWorker.DoWork event. +Simple CamelCase converter ```csharp -protected override void OnDoWork(DoWorkEventArgs e) +public static string ToCamelCase(this string str) ``` -Method parameters
System.ComponentModel.DoWorkEventArgs e
An System.EventArgs that contains the event data.
-Return value
void
Overrides: ComponentModel.BackgroundWorker.OnDoWork +Method parameters
string str
String to convert to Camel Case
+Return value
string
Camel Case converted string
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6371,73 +3081,56 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BaseDisposable Class ## -Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) +## StringExtensions.TrimAndMergeLines(string) Method ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Sources: utils\BaseDisposable.cs -Source-only packages: [RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable) +Type: [StringExtensions](#t-net.adamec.lib.common.extensions.stringextensions__y7rgbb) +Sources: extensions\StringExtensionsWhitespace.cs +Source-only packages: [RadCommons.extensions.StringExtensions.Whitespace](#src-only-package--RadCommons.extensions.StringExtensions.Whitespace) -Helper class for implementation of System.IDisposable types +"Full" trim of the string - the lines within the string are trimmed and then the lines are merged with the space as a separator (instead of the line break) ```csharp -public abstract class BaseDisposable : IDisposable +public static string TrimAndMergeLines(this string str) ``` -Inheritance: object -Derived: [net.adamec.lib.common.utils.Context<TState>](#t-net.adamec.lib.common.utils.context-1__15rsz3v), [net.adamec.lib.common.utils.Disposer](#t-net.adamec.lib.common.utils.disposer__1ejr99q), [net.adamec.lib.common.utils.Scope<TState>](#t-net.adamec.lib.common.utils.scope-1__eepqvi) -Implements: IDisposable +Method parameters
string str
String to full trim
+Return value
string
"Fully" trimmed string
-### Constants ### +Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - | Name | Value | Summary | - | ------ | ------- | --------- | - | [DisposedFlag](#f-net.adamec.lib.common.utils.basedisposable.disposedflag__1kqq0uz) | 1 | Internal flag whether the object is fully disposed | -### Fields ### - - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [isDisposed](#f-net.adamec.lib.common.utils.basedisposable.isdisposed__2u766d) | private | The object is disposed when equals to [DisposedFlag](#f-net.adamec.lib.common.utils.basedisposable.disposedflag__1kqq0uz) | - - - +## TypeExtensions Class ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) +Assembly: net.adamec.lib.common +Sources: extensions\TypeExtensionsDefaultValue.cs +Source-only packages: [RadCommons.extensions.TypeExtensions.DefaultValue](#src-only-package--RadCommons.extensions.TypeExtensions.DefaultValue) -### Properties ### - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [Disposed](#p-net.adamec.lib.common.utils.basedisposable.disposed__nxq2fp) | public | Returns ```csharp true ``` when the object is fully disposed | - | [DisposedManaged](#p-net.adamec.lib.common.utils.basedisposable.disposedmanaged__1pm7df6) | public | Returns ```csharp true ``` when the managed resources are disposed | - | [DisposedNative](#p-net.adamec.lib.common.utils.basedisposable.disposednative__fqjn7i) | public | Returns ```csharp true ``` when the native resources are disposed | +System.Type extensions - -### Destructor ### +```csharp +internal static class TypeExtensions +``` - | Name | Modifier | Summary | - | ------ | ---------- | --------- | - | [~BaseDisposable()](#m-net.adamec.lib.common.utils.basedisposable.finalize__1l3n8dl) | protected | | +Inheritance: object - ### Methods ### | Name | Modifier | Summary | | ------ | ---------- | --------- | - | [AssertNotDisposed(string)](#m-net.adamec.lib.common.utils.basedisposable.assertnotdisposed_system.string___18xs7ya) | protected | Throws an System.ObjectDisposedException when the current object is disposed | - | [Dispose()](#m-net.adamec.lib.common.utils.basedisposable.dispose__6qe9ri) | public | Dispose the object | - | [Dispose(bool)](#m-net.adamec.lib.common.utils.basedisposable.dispose_system.boolean___1vzs8w4) | protected | Internal implementation of dispose - free the managed and native resources using the respective methods | - | [DisposeManaged()](#m-net.adamec.lib.common.utils.basedisposable.disposemanaged__1ht3p85) | protected | Dispose any disposable managed fields or properties. | - | [DisposeNative()](#m-net.adamec.lib.common.utils.basedisposable.disposenative__uaa3i9) | protected | Dispose of COM objects, Handles, etc. Then set those objects to null. | + | [GetDefaultValue(Type)](#m-net.adamec.lib.common.extensions.typeextensions.getdefaultvalue_system.type___vn2w69) | public static | Gets the default value of given type | @@ -6448,23 +3141,28 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BaseDisposable.DisposedFlag Constant ## -Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) +## TypeExtensions.GetDefaultValue(Type) Method ## +Namespace: [net.adamec.lib.common.extensions](#n-net.adamec.lib.common.extensions__1vwuhoq) Assembly: net.adamec.lib.common -Type: [BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) -Sources: utils\BaseDisposable.cs -Source-only packages: [RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable) +Type: [TypeExtensions](#t-net.adamec.lib.common.extensions.typeextensions__63ezc8) +Sources: extensions\TypeExtensionsDefaultValue.cs +Source-only packages: [RadCommons.extensions.TypeExtensions.DefaultValue](#src-only-package--RadCommons.extensions.TypeExtensions.DefaultValue) -Internal flag whether the object is fully disposed +Gets the default value of given type ```csharp -private const int DisposedFlag = 1 +public static object GetDefaultValue(this Type type) ``` -Field value
int
+Method parameters
System.Type type
+Return value
object
Default value of given type . Null for non-value types, new instance for value types.
+ + +### Exceptions ### +
System.ArgumentNullException
type is null
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6473,23 +3171,44 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BaseDisposable.isDisposed Field ## -Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) -Assembly: net.adamec.lib.common -Type: [BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) -Sources: utils\BaseDisposable.cs -Source-only packages: [RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable) +## net.adamec.lib.common.utils Namespace ## +### Classes ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) | public | Executes an operation on a separate thread with possibility of sync cancel. | + | [ConsoleUtils](#t-net.adamec.lib.common.utils.consoleutils__8nc415) | internal static | Console output helpers | + | [Context<TState>](#t-net.adamec.lib.common.utils.context-1__15rsz3v) | internal | Base context implementation. | + | [Disposer](#t-net.adamec.lib.common.utils.disposer__1ejr99q) | internal | Keeps the stack of disposable objects, and disposes them when the disposer is being disposed. | + | [FileUtils](#t-net.adamec.lib.common.utils.fileutils__1bi9r8y) | internal static | File copy utilities | + | [MarshalExt](#t-net.adamec.lib.common.utils.marshalext__7jyavy) | internal static | Marshaling helper methods | + | [PeriodicTask](#t-net.adamec.lib.common.utils.periodictask__1xfynj) | internal static | Helper class allowing to execute periodic (or one time) scheduled action | + | [ProcessEventArgs](#t-net.adamec.lib.common.utils.processeventargs__1gw60ix) | public | The ProcessEventArgs are arguments for a console event. | + | [ProcessUtils](#t-net.adamec.lib.common.utils.processutils__tzt3e1) | internal static | System.Diagnostics.Process related utilities | + | [ProcessWrapper](#t-net.adamec.lib.common.utils.processwrapper__1oqe83p) | public | A class the wraps a process, allowing programmatic input and output. | + | [ProcessWrapper.OutputChunk](#t-net.adamec.lib.common.utils.processwrapper.outputchunk__o3evan) | protected | Internal class to hold the output chunk within the output worker | + | [Scope<TState>](#t-net.adamec.lib.common.utils.scope-1__eepqvi) | internal | Base scope implementation. | + | [Txt](#t-net.adamec.lib.common.utils.txt__1fch6k9) | public | Text builder | + -The object is disposed when equals to [DisposedFlag](#f-net.adamec.lib.common.utils.basedisposable.disposedflag__1kqq0uz) +### Interfaces ### + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [IScope<TState>](#t-net.adamec.lib.common.utils.iscope-1__88aydf) | internal abstract | Scope interface. | -```csharp -private int isDisposed -``` + -Field value
int
+ +### Delegates ### + + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [ProcessEventHandler](#t-net.adamec.lib.common.utils.processeventhandler__8h5v6w) | public | A ProcessEventHandler is a delegate for process output events. | + + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6498,56 +3217,54 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BaseDisposable.Disposed Property ## +## BackgroundWorkerWithSyncCancel Class ## Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) Assembly: net.adamec.lib.common -Type: [BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) -Sources: utils\BaseDisposable.cs -Source-only packages: [RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable) +Sources: utils\BackgroundWorkerWithSyncCancel.cs +Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel)
-Returns -```csharp -true -``` - when the object is fully disposed +Executes an operation on a separate thread with possibility of sync cancel. ```csharp -public bool Disposed { get; } +public class BackgroundWorkerWithSyncCancel : BackgroundWorker ``` -Property value
bool
+Inheritance: object -> System.MarshalByRefObject -> System.ComponentModel.Component -> System.ComponentModel.BackgroundWorker +Implements: System.ComponentModel.IComponent, IDisposable -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) +### Fields ### + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [isCancelling](#f-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.iscancelling__14bxgje) | private | Backing field for [IsCancelling](#p-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.iscancelling__1krty8c) | + | [isRunningInternal](#f-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.isrunninginternal__np6hee) | private | Internal flag whether the worker is running its DoWork action | + | [lockObject](#f-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.lockobject__slen4g) | private | Lock object | + | [resetEvent](#f-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.resetevent__7jv5b7) | private | Reset event used to ensure that the work is finished | -## BaseDisposable.DisposedManaged Property ## -Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) -Assembly: net.adamec.lib.common -Type: [BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) -Sources: utils\BaseDisposable.cs -Source-only packages: [RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable) +### Properties ### + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [IsCancelling](#p-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.iscancelling__1krty8c) | public | Flag whether the worker is cancelling | -Returns -```csharp -true -``` - when the managed resources are disposed + +### Methods ### -```csharp -public bool DisposedManaged { get; private set; } -``` + | Name | Modifier | Summary | + | ------ | ---------- | --------- | + | [Cancel()](#m-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.cancel__1p5og1v) | public | Requests cancellation of a pending background operation and wait for cancel to complete | + | [OnDoWork(DoWorkEventArgs)](#m-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.ondowork_system.componentmodel.doworkeventargs___1euewn7) | protected | Raises the System.ComponentModel.BackgroundWorker.DoWork event. | -Property value
bool
+ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6556,27 +3273,23 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BaseDisposable.DisposedNative Property ## +## BackgroundWorkerWithSyncCancel.isCancelling Field ## Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) Assembly: net.adamec.lib.common -Type: [BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) -Sources: utils\BaseDisposable.cs -Source-only packages: [RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable) +Type: [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) +Sources: utils\BackgroundWorkerWithSyncCancel.cs +Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) -Returns -```csharp -true -``` - when the native resources are disposed +Backing field for [IsCancelling](#p-net.adamec.lib.common.utils.backgroundworkerwithsynccancel.iscancelling__1krty8c) ```csharp -public bool DisposedNative { get; private set; } +private bool isCancelling ``` -Property value
bool
+Field value
bool
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6585,47 +3298,48 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BaseDisposable.~BaseDisposable() Destructor ## +## BackgroundWorkerWithSyncCancel.isRunningInternal Field ## Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) Assembly: net.adamec.lib.common -Type: [BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) -Sources: utils\BaseDisposable.cs -Source-only packages: [RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable) +Type: [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) +Sources: utils\BackgroundWorkerWithSyncCancel.cs +Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) + + +Internal flag whether the worker is running its DoWork action ```csharp - ~BaseDisposable() +private bool isRunningInternal ``` +Field value
bool
+ + Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) -## BaseDisposable.AssertNotDisposed(string) Method ## +## BackgroundWorkerWithSyncCancel.lockObject Field ## Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) Assembly: net.adamec.lib.common -Type: [BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) -Sources: utils\BaseDisposable.cs -Source-only packages: [RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable) +Type: [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) +Sources: utils\BackgroundWorkerWithSyncCancel.cs +Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) -Throws an System.ObjectDisposedException when the current object is disposed +Lock object ```csharp -protected void AssertNotDisposed(string message = null) +private readonly object lockObject ``` -Method parameters
string message
Optional exception message
-Return value
void
- - -### Exceptions ### -
System.ObjectDisposedException
Current object is disposed
+Field value
object
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6634,23 +3348,23 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BaseDisposable.Dispose() Method ## +## BackgroundWorkerWithSyncCancel.resetEvent Field ## Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) Assembly: net.adamec.lib.common -Type: [BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) -Sources: utils\BaseDisposable.cs -Source-only packages: [RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable) +Type: [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) +Sources: utils\BackgroundWorkerWithSyncCancel.cs +Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) -Dispose the object +Reset event used to ensure that the work is finished ```csharp -public void Dispose() +private readonly AutoResetEvent resetEvent ``` -Return value
void
Implements: IDisposable.Dispose +Field value
System.Threading.AutoResetEvent
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6659,24 +3373,23 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BaseDisposable.Dispose(bool) Method ## +## BackgroundWorkerWithSyncCancel.IsCancelling Property ## Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) Assembly: net.adamec.lib.common -Type: [BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) -Sources: utils\BaseDisposable.cs -Source-only packages: [RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable) +Type: [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) +Sources: utils\BackgroundWorkerWithSyncCancel.cs +Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) -Internal implementation of dispose - free the managed and native resources using the respective methods +Flag whether the worker is cancelling ```csharp -protected virtual void Dispose(bool disposing) +public bool IsCancelling { get; } ``` -Method parameters
bool disposing
True to dispose both managed and native resources, false to dispose the native resources only
-Return value
void
+Property value
bool
Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -6685,20 +3398,20 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BaseDisposable.DisposeManaged() Method ## +## BackgroundWorkerWithSyncCancel.Cancel() Method ## Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) Assembly: net.adamec.lib.common -Type: [BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) -Sources: utils\BaseDisposable.cs -Source-only packages: [RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable) +Type: [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) +Sources: utils\BackgroundWorkerWithSyncCancel.cs +Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) -Dispose any disposable managed fields or properties. +Requests cancellation of a pending background operation and wait for cancel to complete ```csharp -protected virtual void DisposeManaged() +public void Cancel() ``` Return value
void
@@ -6710,23 +3423,24 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## BaseDisposable.DisposeNative() Method ## +## BackgroundWorkerWithSyncCancel.OnDoWork(DoWorkEventArgs) Method ## Namespace: [net.adamec.lib.common.utils](#n-net.adamec.lib.common.utils__7vdji9) Assembly: net.adamec.lib.common -Type: [BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) -Sources: utils\BaseDisposable.cs -Source-only packages: [RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable) +Type: [BackgroundWorkerWithSyncCancel](#t-net.adamec.lib.common.utils.backgroundworkerwithsynccancel__1hdlhvo) +Sources: utils\BackgroundWorkerWithSyncCancel.cs +Source-only packages: [RadCommons.utils.BackgroundWorkerWithSyncCancel](#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) -Dispose of COM objects, Handles, etc. Then set those objects to null. +Raises the System.ComponentModel.BackgroundWorker.DoWork event. ```csharp -protected virtual void DisposeNative() +protected override void OnDoWork(DoWorkEventArgs e) ``` -Return value
void
+Method parameters
System.ComponentModel.DoWorkEventArgs e
An System.EventArgs that contains the event data.
+Return value
void
Overrides: ComponentModel.BackgroundWorker.OnDoWork Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -7006,7 +3720,7 @@ internal class Context : BaseDisposable where TState: class, new() ``` Type parameters
TState
Type of the state object managed by the context
-Inheritance: object -> [net.adamec.lib.common.utils.BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) +Inheritance: object -> net.adamec.lib.common.core.utils.BaseDisposable Implements: IDisposable @@ -7381,7 +4095,7 @@ Dispose any disposable managed objects - all disposables kept in [Disposer](#p-n protected override void DisposeManaged() ``` -Return value
void
Overrides: [BaseDisposable.DisposeManaged()](#m-net.adamec.lib.common.utils.basedisposable.disposemanaged__1ht3p85) +Return value
void
Overrides: utils.BaseDisposable.DisposeManaged Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -7405,7 +4119,7 @@ Keeps the stack of disposable objects, and disposes them when the disposer is be internal class Disposer : BaseDisposable ``` -Inheritance: object -> [net.adamec.lib.common.utils.BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) +Inheritance: object -> net.adamec.lib.common.core.utils.BaseDisposable Implements: IDisposable @@ -7532,7 +4246,7 @@ protected override void Dispose(bool disposing) ``` Method parameters
bool disposing
True to dispose both managed and native resources, false to dispose the native resources only.
-Return value
void
Overrides: [BaseDisposable.Dispose(bool)](#m-net.adamec.lib.common.utils.basedisposable.dispose_system.boolean___1vzs8w4) +Return value
void
Overrides: utils.BaseDisposable.Dispose ### Remarks ### @@ -8881,7 +5595,7 @@ internal class Scope : BaseDisposable, IScope where TState: clas ``` Type parameters
TState
Type of the state object managed by the scope
-Inheritance: object -> [net.adamec.lib.common.utils.BaseDisposable](#t-net.adamec.lib.common.utils.basedisposable__7s72ps) +Inheritance: object -> net.adamec.lib.common.core.utils.BaseDisposable Implements: [net.adamec.lib.common.utils.IScope<TState>](#t-net.adamec.lib.common.utils.iscope-1__88aydf), IDisposable @@ -9311,7 +6025,7 @@ Dispose any disposable managed objects - all disposables kept in [Disposer](#p-n protected override void DisposeManaged() ``` -Return value
void
Overrides: [BaseDisposable.DisposeManaged()](#m-net.adamec.lib.common.utils.basedisposable.disposemanaged__1ht3p85) +Return value
void
Overrides: utils.BaseDisposable.DisposeManaged Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) @@ -9942,10 +6656,7 @@ Declaring file: async\AsyncManager.cs Helpers for running the async tasks in sync mode and executing sync actions in async mode (Source only package). -Usings
[RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging)
- - -Package members
[AsyncManager (Type)](#t-net.adamec.lib.common.async.asyncmanager__16s0tm9)
Helpers for running the actions in sync or async mode
[Logger (Field)](#f-net.adamec.lib.common.async.asyncmanager.logger__1nsaphx)
Logger
[DefaultExceptionHandler (Field)](#f-net.adamec.lib.common.async.asyncmanager.defaultexceptionhandler__1ltk17x)
Default exception handler for [RunAsync(Action, Action<System.Exception>)](#m-net.adamec.lib.common.async.asyncmanager.runasync_system.action-system.action_system.exception____s187qk) . Catches and logs all exceptions during the task execution.
[RunAsync(Action, Action<System.Exception>) (Method)](#m-net.adamec.lib.common.async.asyncmanager.runasync_system.action-system.action_system.exception____s187qk)
Runs the given action asynchronously.
[RunSync(Func<System.Threading.Tasks.Task>) (Method)](#m-net.adamec.lib.common.async.asyncmanager.runsync_system.func_system.threading.tasks.task____10vlbqi)
Executes synchronously an async System.Threading.Tasks.Task method which has a void return value
[RunSync<T>(Func<System.Threading.Tasks.Task<T>>) (Method)](#m-net.adamec.lib.common.async.asyncmanager.runsync--1_system.func_system.threading.tasks.task_--0_____jg6lmv)
Executes synchronously an async System.Threading.Tasks.Task`1 method which has a T return type
[AsyncManager.ExclusiveSynchronizationContext (Type)](#t-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext__jzepyu)
"Private" synchronization context used to run the async method
[done (Field)](#f-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.done__1ogbce6)
[InnerException (Property)](#p-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.innerexception__1hzeemf)
[workItemsWaiting (Field)](#f-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.workitemswaiting__9nlexs)
[items (Field)](#f-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.items__f5et9q)
[Send(SendOrPostCallback, object) (Method)](#m-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.send_system.threading.sendorpostcallback-system.object___b8nnwz)
Dispatches a synchronous message to a synchronization context. Always throws System.NotSupportedException as it's not supported in [AsyncManager.ExclusiveSynchronizationContext](#t-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext__jzepyu)
[Post(SendOrPostCallback, object) (Method)](#m-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.post_system.threading.sendorpostcallback-system.object___850uof)
Dispatches an asynchronous message to a synchronization context.
[EndMessageLoop() (Method)](#m-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.endmessageloop__oqnlxn)
Finish the message loop
[BeginMessageLoop() (Method)](#m-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.beginmessageloop__xkfq9n)
Starts the message loop
[CreateCopy() (Method)](#m-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.createcopy__1vp2evu)
Creates a "copy" of the synchronization context.
+Package members
[AsyncManager (Type)](#t-net.adamec.lib.common.async.asyncmanager__16s0tm9)
Helpers for running the actions in sync or async mode
[DefaultExceptionHandler (Field)](#f-net.adamec.lib.common.async.asyncmanager.defaultexceptionhandler__1ltk17x)
Default exception handler for [RunAsync(Action, Action<System.Exception>)](#m-net.adamec.lib.common.async.asyncmanager.runasync_system.action-system.action_system.exception____s187qk) . Catches all exceptions during the task execution.
[RunAsync(Action, Action<System.Exception>) (Method)](#m-net.adamec.lib.common.async.asyncmanager.runasync_system.action-system.action_system.exception____s187qk)
Runs the given action asynchronously.
[RunSync(Func<System.Threading.Tasks.Task>) (Method)](#m-net.adamec.lib.common.async.asyncmanager.runsync_system.func_system.threading.tasks.task____10vlbqi)
Executes synchronously an async System.Threading.Tasks.Task method which has a void return value
[RunSync<T>(Func<System.Threading.Tasks.Task<T>>) (Method)](#m-net.adamec.lib.common.async.asyncmanager.runsync--1_system.func_system.threading.tasks.task_--0_____jg6lmv)
Executes synchronously an async System.Threading.Tasks.Task`1 method which has a T return type
[AsyncManager.ExclusiveSynchronizationContext (Type)](#t-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext__jzepyu)
"Private" synchronization context used to run the async method
[done (Field)](#f-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.done__1ogbce6)
[InnerException (Property)](#p-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.innerexception__1hzeemf)
[workItemsWaiting (Field)](#f-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.workitemswaiting__9nlexs)
[items (Field)](#f-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.items__f5et9q)
[Send(SendOrPostCallback, object) (Method)](#m-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.send_system.threading.sendorpostcallback-system.object___b8nnwz)
Dispatches a synchronous message to a synchronization context. Always throws System.NotSupportedException as it's not supported in [AsyncManager.ExclusiveSynchronizationContext](#t-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext__jzepyu)
[Post(SendOrPostCallback, object) (Method)](#m-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.post_system.threading.sendorpostcallback-system.object___850uof)
Dispatches an asynchronous message to a synchronization context.
[EndMessageLoop() (Method)](#m-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.endmessageloop__oqnlxn)
Finish the message loop
[BeginMessageLoop() (Method)](#m-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.beginmessageloop__xkfq9n)
Starts the message loop
[CreateCopy() (Method)](#m-net.adamec.lib.common.async.asyncmanager.exclusivesynchronizationcontext.createcopy__1vp2evu)
Creates a "copy" of the synchronization context.
Sources
async\AsyncManager.cs
@@ -9978,47 +6689,6 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## RadCommons.config.Configuration Source only package ## -Tags: RadCommons source-only configuration -Includes: None -Declaring file: config\Configuration.cs - - -Simple configuration container in case DI with more sophisticated containers is not used. Supports the JSON config files, command line arguments - and environment variables as sources and their hierarchy/overrides. The configuration can be used as key-value pairs or bound to objects (Source only package). - - -Usings
[RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging)
- - -### Remarks ### -This is the simple configuration container in case DI with more sophisticated containers is not used The configuration is stored as the key-value dictionary, supporting hierarchy using the dot separator and arrays.The arrays can contain values or another objects. Actually, mixed arrays of values and objects can be stored, but they are not supported for binding. For example `section1.option1` means the option1 available in section1, `section1.subSection2.option1` means the option1 available in section1.subSection2. `section1.option1[0]` means, that the option1 is array of values or objects (sections) within the section1. For arrays, the keys are like `OtherSection.SimpleArray[0]` or `OtherSection.ComplexObjectArray[0].Name` - - [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) class provides a singleton instance, however the key functionality is provided via static functions, so no need to touch the [Instance](#p-net.adamec.lib.common.config.configuration.instance__131avv7) at all. The items can be retrieved by key using the [Get(string)](#m-net.adamec.lib.common.config.configuration.get_system.string___8ykaxa) and [Get<TValueType>(string, Configuration.TValueType)](#m-net.adamec.lib.common.config.configuration.get--1_system.string---0___1dcpnhz) methods. The first one returns null when the key is not found, the other one allow to define the default value to be returned, when the item is not found. - - The inner class [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj) provides the methods to build the configuration from JSON config files, commandline arguments, environment values and/or direct entries. The static method [Builder()](#m-net.adamec.lib.common.config.configuration.builder__700lxw) clears the configuration items and binding cache and creates a new instance of [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj) allowing to build a configuration from scratch. The configuration is updated directly during the calls to builder methods, the existing items (keys) are updated, so it's possible to manage the priority of individual sources and the overrides if needed. The method [Build()](#m-net.adamec.lib.common.config.configuration.configurationbuilder.build__bwvls6) returns the configuration instance, breaking the fluent design of builder methods, however there is no other functionality within the method, so it's more the convention than need to use it at the end of configuration build. - - Configuration binding it the way, how to access the configuration using the configuration objects instead of querying the individual items by key. When the method [Bind<TOptionsContainer>(string, bool)](#m-net.adamec.lib.common.config.configuration.bind--1_system.string-system.boolean___16p0943) is used, it creates a new instance of given type and tries to map the public properties with public setter to the keys (using the "dot notation") within the [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) . It's possible to bind the object to to the root of the configuration to provide the whole configuration at once or bind it to the particular section to provide a configuration sub-tree. In general, the nested objects and both value and object arrays are supported. There are some rules when binding the arrays: The index must start with zero and must be in sequence (the first non-existing index stops the evaluation). The array should not mix the array or values and array of objects. The decision is made at the first item (index=0) whether it's value or object. - - The implementation of binding treats the
System.Boolean values the special way - if there is no value, but existing key, the value is converted to true. This is useful when the command line arguments are used like flags. For example having the argument `-p:SkipStep1` and prefix `-p:` , the binding a bool property `SkipStep1` will set the value of the property to `true` (doesn't change the configuration item itself). Of course, it's still possible to use the syntax `-p:SkipStep1=true` or `-p:SkipStep1=false` even in this case. - - As the binding uses the reflection, it's quite expensive operation, so by default, the bound objects are cached (the cache key is the type of bound object, so binding the same type to different sections is not recommended ). It's possible to force the binding using the parameter of [Bind<TOptionsContainer>(string, bool)](#m-net.adamec.lib.common.config.configuration.bind--1_system.string-system.boolean___16p0943) method. In general, the recommended pattern is to [Bind<TOptionsContainer>(string, bool)](#m-net.adamec.lib.common.config.configuration.bind--1_system.string-system.boolean___16p0943) the configuration object after the configuration is built and then [Retrieve<TOptionsContainer>()](#m-net.adamec.lib.common.config.configuration.retrieve--1__1xuxip8) it from the cache when needed. - - - - -Package members
[Configuration (Type)](#t-net.adamec.lib.common.config.configuration__1md5nwk)
Singleton holding the application configuration (options)
[instance (Field)](#f-net.adamec.lib.common.config.configuration.instance__1aq1w9t)
Instance of the [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) created when the singleton is first touched
[Instance (Property)](#p-net.adamec.lib.common.config.configuration.instance__131avv7)
Public [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) instance
[Configuration() (Method)](#m-net.adamec.lib.common.config.configuration.-cctor__1xl390h)
Static constructor
[Configuration() (Method)](#m-net.adamec.lib.common.config.configuration.-ctor__11tp9ak)
Private constructor used to build the singleton instance
[Items (Property)](#p-net.adamec.lib.common.config.configuration.items__1i9u236)
Configuration items stored as key-value pairs
[Get(string) (Method)](#m-net.adamec.lib.common.config.configuration.get_system.string___8ykaxa)
Gets the configuration item by key
[Get<TValueType>(string, Configuration.TValueType) (Method)](#m-net.adamec.lib.common.config.configuration.get--1_system.string---0___1dcpnhz)
Gets the typed configuration item by key . Returns the default value, that can be provided or is default to given TValueType The function tries to convert the value to TValueType using System.Convert.ChangeType(System.Object,System.Type) if the conversion is not successful, the default is returned.
[bindingsCache (Field)](#f-net.adamec.lib.common.config.configuration.bindingscache__thj354)
Cache for bindings. Dictionary of type bound as a key and the bound object as value.
[Bind<TOptionsContainer>(string, bool) (Method)](#m-net.adamec.lib.common.config.configuration.bind--1_system.string-system.boolean___16p0943)
Binds the configuration to given TOptionsContainer type and returns the bound object of such type. The resulting configuration object is stored to the cache and can be later on retrieved using [Retrieve<TOptionsContainer>()](#m-net.adamec.lib.common.config.configuration.retrieve--1__1xuxip8)
[Retrieve<TOptionsContainer>() (Method)](#m-net.adamec.lib.common.config.configuration.retrieve--1__1xuxip8)
Retrieves the configuration object of given TOptionsContainer that has been bound and cached before. The new instance of TOptionsContainer is created when the type not found in cache
[Bind(Type, string) (Method)](#m-net.adamec.lib.common.config.configuration.bind_system.type-system.string___1b0yb6e)
Creates a new object with given type and binds the configuration to its public properties where possible.
[GetSection(string) (Method)](#m-net.adamec.lib.common.config.configuration.getsection_system.string___17z37ez)
Gets the configuration sub-tree that belongs to given section. The keys returned are relative to given section! When the section is not provided, the whole configuration tree is returned.
[TryConvertValue(Type, object, object) (Method)](#m-net.adamec.lib.common.config.configuration.tryconvertvalue_system.type-system.object-system.object-___1f1lwmk)
Tries to convert sourceValue to targetType . The converted values is returned in targetValue out parameter, the result of conversion is the function return value.
[AddOrUpdateItem(string, object) (Method)](#m-net.adamec.lib.common.config.configuration.addorupdateitem_system.string-system.object___1atv1og)
Add a new configuration item with given value or updates its value if the key already exists.
[Builder() (Method)](#m-net.adamec.lib.common.config.configuration.builder__700lxw)
Clears the configuration items and binding cache and creates a new instance of [Configuration.ConfigurationBuilder](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj)
[Configuration.ConfigurationBuilder (Type)](#t-net.adamec.lib.common.config.configuration.configurationbuilder__13eawwj)
Configuration builder providing the methods for adding the configuration items from individual sources
[Build() (Method)](#m-net.adamec.lib.common.config.configuration.configurationbuilder.build__bwvls6)
Finishes the configuration building and returns the [Instance](#p-net.adamec.lib.common.config.configuration.instance__131avv7)
[Add(string, object) (Method)](#m-net.adamec.lib.common.config.configuration.configurationbuilder.add_system.string-system.object___t030mu)
Add a new configuration item with given value or updates its value if the key already exists.
[AddEnvironmentVariables() (Method)](#m-net.adamec.lib.common.config.configuration.configurationbuilder.addenvironmentvariables__1behrcd)
Adds all environment variables into the [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) . When a configuration item exists, the value is updated.
[AddCommandLineArguments(string[]) (Method)](#m-net.adamec.lib.common.config.configuration.configurationbuilder.addcommandlinearguments_system.string_____f7vkq1)
Adds the command line arguments starting with prefixes into the [Configuration](#t-net.adamec.lib.common.config.configuration__1md5nwk) . When a configuration item exists, the value is updated.
[AddJsonFile(string, bool, bool) (Method)](#m-net.adamec.lib.common.config.configuration.configurationbuilder.addjsonfile_system.string-system.boolean-system.boolean___fpcrpi)
Loads the configuration items from JSON file, keeping the hierarchy of JSON objects (and arrays) When a configuration item exists, the value is updated.
- - -Sources
config\Configuration.cs
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - ## RadCommons.di.Component Source only package ## Tags: RadCommons source-only RadCommons-DI dependency-injection components Includes: Folder @@ -10028,9 +6698,6 @@ Declaring file: di\component\_SourceOnlyPackage.cs RadCommons DI Component - allows to mark and inject the component using the class attributes (Source only package). -Usings
[RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging)
[RadCommons.di.Component](#src-only-package--RadCommons.di.Component)
- - References needed
Autofac
@@ -10055,13 +6722,13 @@ Declaring file: di\config\_SourceOnlyPackage.cs RadCommons DI helpers for application configuration (Source only package). -Usings
[RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging)
+Usings
RadCommons.logging.CommonLogging
References needed
Autofac
Microsoft.Extensions.Configuration
Microsoft.Extensions.DependencyInjection
-Package members
[AutoOptionsAttribute (Type)](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2)
Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI
[RegisterDirect (Property)](#p-net.adamec.lib.common.di.config.autooptionsattribute.registerdirect__1s9s1yk)
Flag whether to create and registers the options class instance into MS DI
[ConfigSection (Property)](#p-net.adamec.lib.common.di.config.autooptionsattribute.configsection__zo6f6l)
Path to the section within appsettings.json
[AutoOptionsAttribute(string, bool) (Method)](#m-net.adamec.lib.common.di.config.autooptionsattribute.-ctor_system.string-system.boolean___1nw898o)
Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI
[ServiceCollectionAutoOptionsException (Type)](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionAutoOptionsExtension
[ServiceCollectionAutoOptionsException() (Method)](#m-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception.-ctor__o6ojyb)
Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
[ServiceCollectionAutoOptionsException(string) (Method)](#m-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception.-ctor_system.string___1kcodie)
Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
[ServiceCollectionAutoOptionsException(string, Exception) (Method)](#m-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception.-ctor_system.string-system.exception___r0rfi6)
Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
[ServiceCollectionConfigureDirectException (Type)](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj)
Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionConfigureDirectExtensions
[ServiceCollectionConfigureDirectException() (Method)](#m-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception.-ctor__1n8hr1d)
Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj)
[ServiceCollectionConfigureDirectException(string) (Method)](#m-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception.-ctor_system.string___1dp1v34)
Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj)
[ServiceCollectionConfigureDirectException(string, Exception) (Method)](#m-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception.-ctor_system.string-system.exception___1uv85c8)
Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj)
[ContainerBuilderExtensions (Type)](#t-net.adamec.lib.common.di.config.extensions.containerbuilderextensions__tpisv7)
Autofac Autofac.ContainerBuilder extensions
[AddAutoOptions(ContainerBuilder, IConfigurationRoot, Assembly[]) (Method)](#m-net.adamec.lib.common.di.config.extensions.containerbuilderextensions.addautooptions_autofac.containerbuilder-microsoft.extensions.configuration.iconfigurationroot-system.reflection.assembly_____pfqod1)
Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions
[AddAutoOptions(ContainerBuilder, IConfigurationRoot, Type[]) (Method)](#m-net.adamec.lib.common.di.config.extensions.containerbuilderextensions.addautooptions_autofac.containerbuilder-microsoft.extensions.configuration.iconfigurationroot-system.type_____1fbl63e)
Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions
[AddOptions<TOptions>(ContainerBuilder, IConfigurationRoot, string) (Method)](#m-net.adamec.lib.common.di.config.extensions.containerbuilderextensions.addoptions--1_autofac.containerbuilder-microsoft.extensions.configuration.iconfigurationroot-system.string___1b2rpkf)
Creates and registers the singleton of configuration (options) class of given type This is to be used if not registered using the [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2)
[ServiceCollectionAutoOptionsExtension (Type)](#t-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension__1p9fgao)
Extensions for options (configuration) class automatic binding to appsettings.json
[Logger (Field)](#f-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension.logger__1gx9pyg)
[ConfigureAutoOptions(IServiceCollection, IConfigurationRoot, Assembly[]) (Method)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension.configureautooptions_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfigurationroot-system.reflection.assembly_____1kc5g1y)
Scans given assemblies for classes marked with [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI
[ConfigureAutoOptions(IServiceCollection, IConfiguration, Assembly[]) (Method)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension.configureautooptions_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration-system.reflection.assembly_____bfjrc2)
Scans given assemblies for classes marked with [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI
[ServiceCollectionConfigureDirectExtensions (Type)](#t-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions__wdwckv)
Extensions for options (configuration) class registration into MS DI
[ConfigureDirect(IServiceCollection, Type, IConfiguration) (Method)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect_microsoft.extensions.dependencyinjection.iservicecollection-system.type-microsoft.extensions.configuration.iconfiguration___1lbalbi)
Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI.
[ConfigureDirect<TConfig>(IServiceCollection, IConfiguration) (Method)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect--1_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration___1049ily)
Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI.
[ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, Func<TConfig>) (Method)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect--1_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration-system.func_--0____1uka1kl)
Gets the instance of the options (configuration) class from pocoProvider , binds (fills) it to the configuration and registers is as singleton into MS DI.
[ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, ServiceCollectionConfigureDirectExtensions.TConfig) (Method)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect--1_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration---0___18sq65m)
Binds (fills) given instance of the options (configuration) class to configuration and registers is as singleton into MS DI.
+Package members
[AutoOptionsAttribute (Type)](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2)
Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI
[RegisterDirect (Property)](#p-net.adamec.lib.common.di.config.autooptionsattribute.registerdirect__1s9s1yk)
Flag whether to create and registers the options class instance into MS DI
[ConfigSection (Property)](#p-net.adamec.lib.common.di.config.autooptionsattribute.configsection__zo6f6l)
Path to the section within appsettings.json
[AutoOptionsAttribute(string, bool) (Method)](#m-net.adamec.lib.common.di.config.autooptionsattribute.-ctor_system.string-system.boolean___1nw898o)
Class attribute allowing the auto registration of options class into .NET Core configuration framework and optional direct registration of singleton instance into MS DI
[ServiceCollectionAutoOptionsException (Type)](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionAutoOptionsExtension
[ServiceCollectionAutoOptionsException() (Method)](#m-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception.-ctor__o6ojyb)
Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
[ServiceCollectionAutoOptionsException(string) (Method)](#m-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception.-ctor_system.string___1kcodie)
Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
[ServiceCollectionAutoOptionsException(string, Exception) (Method)](#m-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception.-ctor_system.string-system.exception___r0rfi6)
Creates [ServiceCollectionAutoOptionsException](#t-net.adamec.lib.common.di.config.exception.servicecollectionautooptionsexception__1bgevbh)
[ServiceCollectionConfigureDirectException (Type)](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj)
Exception thrown by net.adamec.home.control.common.config.exception.ServiceCollectionConfigureDirectExtensions
[ServiceCollectionConfigureDirectException() (Method)](#m-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception.-ctor__1n8hr1d)
Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj)
[ServiceCollectionConfigureDirectException(string) (Method)](#m-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception.-ctor_system.string___1dp1v34)
Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj)
[ServiceCollectionConfigureDirectException(string, Exception) (Method)](#m-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception.-ctor_system.string-system.exception___1uv85c8)
Creates [ServiceCollectionConfigureDirectException](#t-net.adamec.lib.common.di.config.exception.servicecollectionconfiguredirectexception__1q7o5xj)
[ContainerBuilderExtensions (Type)](#t-net.adamec.lib.common.di.config.extensions.containerbuilderextensions__tpisv7)
Autofac Autofac.ContainerBuilder extensions
[AddAutoOptions(ContainerBuilder, IConfigurationRoot, Assembly[]) (Method)](#m-net.adamec.lib.common.di.config.extensions.containerbuilderextensions.addautooptions_autofac.containerbuilder-microsoft.extensions.configuration.iconfigurationroot-system.reflection.assembly_____pfqod1)
Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions
[AddAutoOptions(ContainerBuilder, IConfigurationRoot, Type[]) (Method)](#m-net.adamec.lib.common.di.config.extensions.containerbuilderextensions.addautooptions_autofac.containerbuilder-microsoft.extensions.configuration.iconfigurationroot-system.type_____1fbl63e)
Creates and registers the singletons of configuration (options) classes with AutoOptions attribute marked for RegisteredDirect. This is to be used if not registered via MS ServiceCollection extensions
[AddOptions<TOptions>(ContainerBuilder, IConfigurationRoot, string) (Method)](#m-net.adamec.lib.common.di.config.extensions.containerbuilderextensions.addoptions--1_autofac.containerbuilder-microsoft.extensions.configuration.iconfigurationroot-system.string___1b2rpkf)
Creates and registers the singleton of configuration (options) class of given type This is to be used if not registered using the [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2)
[ServiceCollectionAutoOptionsExtension (Type)](#t-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension__1p9fgao)
Extensions for options (configuration) class automatic binding to appsettings.json
[ConfigureAutoOptions(IServiceCollection, IConfigurationRoot, Assembly[]) (Method)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension.configureautooptions_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfigurationroot-system.reflection.assembly_____1kc5g1y)
Scans given assemblies for classes marked with [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI
[ConfigureAutoOptions(IServiceCollection, IConfiguration, Assembly[]) (Method)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionautooptionsextension.configureautooptions_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration-system.reflection.assembly_____bfjrc2)
Scans given assemblies for classes marked with [AutoOptionsAttribute](#t-net.adamec.lib.common.di.config.autooptionsattribute__19ezdz2) and binds them to appsettings.json configuration section defined in attribute. Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI
[ServiceCollectionConfigureDirectExtensions (Type)](#t-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions__wdwckv)
Extensions for options (configuration) class registration into MS DI
[ConfigureDirect(IServiceCollection, Type, IConfiguration) (Method)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect_microsoft.extensions.dependencyinjection.iservicecollection-system.type-microsoft.extensions.configuration.iconfiguration___1lbalbi)
Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI.
[ConfigureDirect<TConfig>(IServiceCollection, IConfiguration) (Method)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect--1_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration___1049ily)
Creates the instance of the options (configuration) class, binds (fills) it to the configuration and registers is as singleton into MS DI.
[ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, Func<TConfig>) (Method)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect--1_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration-system.func_--0____1uka1kl)
Gets the instance of the options (configuration) class from pocoProvider , binds (fills) it to the configuration and registers is as singleton into MS DI.
[ConfigureDirect<TConfig>(IServiceCollection, IConfiguration, ServiceCollectionConfigureDirectExtensions.TConfig) (Method)](#m-net.adamec.lib.common.di.config.extensions.servicecollectionconfiguredirectextensions.configuredirect--1_microsoft.extensions.dependencyinjection.iservicecollection-microsoft.extensions.configuration.iconfiguration---0___18sq65m)
Binds (fills) given instance of the options (configuration) class to configuration and registers is as singleton into MS DI.
Sources
di\config\_SourceOnlyPackage.cs
di\config\AutoOptionsAttribute.cs
di\config\exception\ServiceCollectionAutoOptionsException.cs
di\config\exception\ServiceCollectionConfigureDirectException.cs
di\config\extensions\ContainerBuilderExtensions.cs
di\config\extensions\ServiceCollectionAutoOptionsExtension.cs
di\config\extensions\ServiceCollectionConfigureDirectExtensions.cs
@@ -10082,13 +6749,13 @@ Declaring file: di\postinit\_SourceOnlyPackage.cs RadCommons DI PostInit - allows to run post init method of component (Source only package). -Usings
[RadCommons.logging.CommonLogging](#src-only-package--RadCommons.logging.CommonLogging)
[RadCommons.di.Component](#src-only-package--RadCommons.di.Component)
+Usings
[RadCommons.di.Component](#src-only-package--RadCommons.di.Component)
References needed
Autofac
-Package members
[ContainerBuilderExtensions (Type)](#t-net.adamec.lib.common.di.postinit.containerbuilderextensions__7mjuw3)
Autofac Autofac.ContainerBuilder extensions
[Logger (Field)](#f-net.adamec.lib.common.di.postinit.containerbuilderextensions.logger__1tek0s3)
Logger
[AddComponentPostInitSupport(ContainerBuilder) (Method)](#m-net.adamec.lib.common.di.postinit.containerbuilderextensions.addcomponentpostinitsupport_autofac.containerbuilder___nsekfd)
Adds the support of [PostInitAttribute](#t-net.adamec.lib.common.di.postinit.postinitattribute__qimmrl) to the Autofac container builder.
[ProcessComponentPostInit(IContainer) (Method)](#m-net.adamec.lib.common.di.postinit.containerbuilderextensions.processcomponentpostinit_autofac.icontainer___uo3mji)
Executes the components' post init methods
[PostInitAttribute (Type)](#t-net.adamec.lib.common.di.postinit.postinitattribute__qimmrl)
Allows to run post init method of component. Component must be registered using the Component attribute as singleton in root scope and must register self Parameters of "marked" post init method are resolved from container (throws an exception on failure)
+Package members
[ContainerBuilderExtensions (Type)](#t-net.adamec.lib.common.di.postinit.containerbuilderextensions__7mjuw3)
Autofac Autofac.ContainerBuilder extensions
[AddComponentPostInitSupport(ContainerBuilder) (Method)](#m-net.adamec.lib.common.di.postinit.containerbuilderextensions.addcomponentpostinitsupport_autofac.containerbuilder___nsekfd)
Adds the support of [PostInitAttribute](#t-net.adamec.lib.common.di.postinit.postinitattribute__qimmrl) to the Autofac container builder.
[ProcessComponentPostInit(IContainer) (Method)](#m-net.adamec.lib.common.di.postinit.containerbuilderextensions.processcomponentpostinit_autofac.icontainer___uo3mji)
Executes the components' post init methods
[PostInitAttribute (Type)](#t-net.adamec.lib.common.di.postinit.postinitattribute__qimmrl)
Allows to run post init method of component. Component must be registered using the Component attribute as singleton in root scope and must register self Parameters of "marked" post init method are resolved from container (throws an exception on failure)
Sources
di\postinit\_SourceOnlyPackage.cs
di\postinit\ContainerBuilderExtensions.cs
di\postinit\PostInitAttribute.cs
@@ -10310,100 +6977,6 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -##
RadCommons.logging.CommonLogging Source only package ## -Tags: RadCommons source-only logging NLog -Includes: Folder -Declaring file: logging\_SourceOnlyPackage.cs - - -RadCommons logging wrapper around NLog with some extended functionality (Source only package). - - -References needed
NLog
- - -### Remarks ### -The NLog supports having additional (custom) event properties provided to loggers and optionally rendered to logs. The event properties are represented as key-value dictionary, where key is the unique name of the property. Extended logger provides following methods to log with given set of the properties. - - - - - - [Trace(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.trace_system.collections.generic.dictionary_system.string-system.object_-system.string___15kc02k) , - - [Debug(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.debug_system.collections.generic.dictionary_system.string-system.object_-system.string___jxdraq) , - - [Info(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.info_system.collections.generic.dictionary_system.string-system.object_-system.string___1kbhewr) , - - [Warn(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.string___1hy0rp3) , - - [Error(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.string___kfa9gl) , - - [Fatal(Dictionary<string,object>, string)](#m-net.adamec.lib.common.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.string___1yxmkzz) , - - [Warn(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___10z37vj) , - - [Error(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___1watp5d) and - - [Fatal(Dictionary<string,object>, Exception, string)](#m-net.adamec.lib.common.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___175gumn) - - - - - - Sometimes, it's useful to have an exception logging method implemented as the operation returning the exception being logged. The [ErrorPassThrough(Exception, string)](#m-net.adamec.lib.common.logging.ilogger.errorpassthrough_system.exception-system.string___1vc33gk) and [FatalPassThrough(Exception, string)](#m-net.adamec.lib.common.logging.ilogger.fatalpassthrough_system.exception-system.string___1fx8xs8) methods will log given exception and return it for further processing. -```csharp - try - { - ... - } - catch (Exception ex){ - if(logger.ErrorPassThrough(ex) is MyException){ - return null; - }else{ - throw; - } - } -``` - In the example above, the exception is always logged and then the decision/action is taken. - - C# 6 brought the exception filters that don't unwind the stack as the exception is not catch yet when processing the filter. It can also be used for logging the exceptions without actually catching them (when the exception filter returns `false` ). Extended logger provides functions [ErrorFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.logging.ilogger.errorfltr--1_--0-system.string-system.boolean___135nosm) and [FatalFltr<TException>(ILogger.TException, string, bool)](#m-net.adamec.lib.common.logging.ilogger.fatalfltr--1_--0-system.string-system.boolean___1av7ixa) for this purpose. -```csharp - try - { - ... - } - catch (Exception ex) when (logger.ErrorFltr(ex,"Error here!"){ - //newer called as the default return value of ErrorFltr is false - } -``` - The example above logs but never catch all exceptions. The following code catch and log the ArgumentException and logs any other exception without catching it. -```csharp - try - { - ... - } - catch (ArgumentException e) when (Logger.ErrorFltr(e,catchIt:true)) { ... } - catch (Exception e) when (Logger.FatalFltr(e)) {} -``` - - - Logger can also create and exception, log it and return using functions [Error<TException>(string, Exception)](#m-net.adamec.lib.common.logging.ilogger.error--1_system.string-system.exception___pmrssh) and [Fatal<TException>(string, Exception)](#m-net.adamec.lib.common.logging.ilogger.fatal--1_system.string-system.exception___x5u73) -```csharp - if(value is null) throw logger.Fatal("Value is null"); -``` - - - When logging an exception using the [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) methods, the event property `StackTrace` is set from
System.Exception.StackTrace , when the logger creates an exception, the property is set using `new StackTrace(2, true).ToString()` . In other cases when the System.Exception.StackTrace is null or empty, `new StackTrace(true).ToString()` is used. - - [LoggerExt](#t-net.adamec.lib.common.logging.loggerext__ac9km2) also provides set of methods for logging with the correlation ID (for example in integration scenarios), where the given correlation ID is set to the event property `CorrelationId` . Such methods have the name ending with `Corr` suffix. - - - - -Package members
[CommonLogging (Type)](#t-net.adamec.lib.common.logging.commonlogging__1dar5wb)
[ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm) factory
[CreateLogger(string) (Method)](#m-net.adamec.lib.common.logging.commonlogging.createlogger_system.string___wn77if)
Creates the logger with given categoryName
[CreateLogger(Type) (Method)](#m-net.adamec.lib.common.logging.commonlogging.createlogger_system.type___uhum9e)
Creates the logger for given type. The name of the logger will be System.Type.FullName
[CreateLogger<T>() (Method)](#m-net.adamec.lib.common.logging.commonlogging.createlogger--1__lp2vax)
Creates the logger for given type. The name of the logger will be System.Type.FullName
[ILogger (Type)](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
Logger interface - wrapper around the NLog.ILogger with some additional methods
[TraceCorr(string, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.tracecorr_system.string-system.string___1bdni2z)
Writes the diagnostic message at the `Trace` level with correlation ID.
[DebugCorr(string, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.debugcorr_system.string-system.string___aozvfj)
Writes the diagnostic message at the `Debug` level with correlation ID.
[InfoCorr(string, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.infocorr_system.string-system.string___2iypny)
Writes the diagnostic message at the `Info` level with correlation ID.
[WarnCorr(string, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.warncorr_system.string-system.string___pr2tiu)
Writes the diagnostic message at the `Warn` level with correlation ID.
[ErrorCorr(string, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.errorcorr_system.string-system.string___coifvu)
Writes the diagnostic message at the `Error` level with correlation ID.
[FatalCorr(string, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.fatalcorr_system.string-system.string___ufcx32)
Writes the diagnostic message at the `Fatal` level with correlation ID.
[WarnCorr(string, Exception, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.warncorr_system.string-system.exception-system.string___1kh0i9m)
Writes the diagnostic message at the `Warn` level with correlation ID.
[ErrorCorr(string, Exception, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.errorcorr_system.string-system.exception-system.string___1qll13u)
Writes the diagnostic message at the `Error` level with correlation ID.
[FatalCorr(string, Exception, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.fatalcorr_system.string-system.exception-system.string___yt34nm)
Writes the diagnostic message at the `Fatal` level with correlation ID.
[ErrorCorr<TException>(string, ILogger.TException, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.errorcorr--1_system.string---0-system.string___eypxkv)
Writes the diagnostic message at the `Error` level and returns the exception of given type
[FatalCorr<TException>(string, ILogger.TException, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.fatalcorr--1_system.string---0-system.string___108vdu1)
Writes the diagnostic message at the `Fatal` level and returns the exception of given type
[ErrorCorr<TException>(string, string, Exception) (Method)](#m-net.adamec.lib.common.logging.ilogger.errorcorr--1_system.string-system.string-system.exception___91akh7)
Writes the diagnostic message at the `Error` level with correlation ID. Creates and returns the exception of given type
[FatalCorr<TException>(string, string, Exception) (Method)](#m-net.adamec.lib.common.logging.ilogger.fatalcorr--1_system.string-system.string-system.exception___1hlu7x)
Writes the diagnostic message at the `Fatal` level with correlation ID. Creates and returns the exception of given type
[ErrorFltrCorr<TException>(string, ILogger.TException, string, bool) (Method)](#m-net.adamec.lib.common.logging.ilogger.errorfltrcorr--1_system.string---0-system.string-system.boolean___1spds2w)
Writes the diagnostic message at the `Error` level and returns the exception of given type
[FatalFltrCorr<TException>(string, ILogger.TException, string, bool) (Method)](#m-net.adamec.lib.common.logging.ilogger.fatalfltrcorr--1_system.string---0-system.string-system.boolean___a9m338)
Writes the diagnostic message at the `Fatal` level and returns catchIt value.
[ILogger (Type)](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
Logger interface - wrapper around the NLog.ILogger with some additional methods
[ILogger (Type)](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
Logger interface - wrapper around the NLog.ILogger with some additional methods
[Trace(Dictionary<string,object>, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.trace_system.collections.generic.dictionary_system.string-system.object_-system.string___15kc02k)
Writes the diagnostic message at the `Trace` level.
[Debug(Dictionary<string,object>, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.debug_system.collections.generic.dictionary_system.string-system.object_-system.string___jxdraq)
Writes the diagnostic message at the `Debug` level.
[Info(Dictionary<string,object>, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.info_system.collections.generic.dictionary_system.string-system.object_-system.string___1kbhewr)
Writes the diagnostic message at the `Info` level.
[Warn(Dictionary<string,object>, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.string___1hy0rp3)
Writes the diagnostic message at the `Warn` level.
[Error(Dictionary<string,object>, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.string___kfa9gl)
Writes the diagnostic message at the `Error` level.
[Fatal(Dictionary<string,object>, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.string___1yxmkzz)
Writes the diagnostic message at the `Fatal` level.
[Warn(Dictionary<string,object>, Exception, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.warn_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___10z37vj)
Writes the diagnostic message at the `Warn` level.
[Error(Dictionary<string,object>, Exception, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.error_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___1watp5d)
Writes the diagnostic message at the `Error` level.
[Fatal(Dictionary<string,object>, Exception, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.fatal_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___175gumn)
Writes the diagnostic message at the `Fatal` level.
[ILogger (Type)](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
Logger interface - wrapper around the NLog.ILogger with some additional methods
[ErrorFltr<TException>(ILogger.TException, string, bool) (Method)](#m-net.adamec.lib.common.logging.ilogger.errorfltr--1_--0-system.string-system.boolean___135nosm)
Writes the diagnostic message at the `Error` level and returns the exception of given type
[FatalFltr<TException>(ILogger.TException, string, bool) (Method)](#m-net.adamec.lib.common.logging.ilogger.fatalfltr--1_--0-system.string-system.boolean___1av7ixa)
Writes the diagnostic message at the `Fatal` level and returns catchIt value.
[ILogger (Type)](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
Logger interface - wrapper around the NLog.ILogger with some additional methods
[ErrorPassThrough(Exception, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.errorpassthrough_system.exception-system.string___1vc33gk)
Writes the diagnostic message at the `Error` level and returns given exception
[FatalPassThrough(Exception, string) (Method)](#m-net.adamec.lib.common.logging.ilogger.fatalpassthrough_system.exception-system.string___1fx8xs8)
Writes the diagnostic message at the `Fatal` level and returns given exception
[Error<TException>(string, Exception) (Method)](#m-net.adamec.lib.common.logging.ilogger.error--1_system.string-system.exception___pmrssh)
Writes the diagnostic message at the `Error` level. Creates and returns the exception of given type
[Fatal<TException>(string, Exception) (Method)](#m-net.adamec.lib.common.logging.ilogger.fatal--1_system.string-system.exception___x5u73)
Writes the diagnostic message at the `Fatal` level. Creates and returns the exception of given type
[LoggerExt (Type)](#t-net.adamec.lib.common.logging.loggerext__ac9km2)
Extended logger implementing [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
[TraceCorr(string, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.tracecorr_system.string-system.string___1e218kz)
Writes the diagnostic message at the `Trace` level with correlation ID
[DebugCorr(string, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.debugcorr_system.string-system.string___i119af)
Writes the diagnostic message at the `Debug` level with correlation ID.
[InfoCorr(string, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.infocorr_system.string-system.string___3vobha)
Writes the diagnostic message at the `Info` level with correlation ID.
[WarnCorr(string, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.warncorr_system.string-system.string___cfr64e)
Writes the diagnostic message at the `Warn` level with correlation ID.
[ErrorCorr(string, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.errorcorr_system.string-system.string___1vt0qk2)
Writes the diagnostic message at the `Error` level with correlation ID.
[FatalCorr(string, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.fatalcorr_system.string-system.string___c131ta)
Writes the diagnostic message at the `Fatal` level with correlation ID.
[WarnCorr(string, Exception, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.warncorr_system.string-system.exception-system.string___sfdb1u)
Writes the diagnostic message at the `Warn` level with correlation ID.
[ErrorCorr(string, Exception, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.errorcorr_system.string-system.exception-system.string___1tdd1hu)
Writes the diagnostic message at the `Error` level with correlation ID.
[FatalCorr(string, Exception, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.fatalcorr_system.string-system.exception-system.string___1q1adwi)
Writes the diagnostic message at the `Fatal` level with correlation ID.
[ErrorCorr<TException>(string, LoggerExt.TException, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.errorcorr--1_system.string---0-system.string___bk3vj3)
Writes the diagnostic message at the `Error` level and returns the exception of given type
[FatalCorr<TException>(string, LoggerExt.TException, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.fatalcorr--1_system.string---0-system.string___17i1735)
Writes the diagnostic message at the `Fatal` level and returns the exception of given type
[ErrorCorr<TException>(string, string, Exception) (Method)](#m-net.adamec.lib.common.logging.loggerext.errorcorr--1_system.string-system.string-system.exception___4hcjn7)
Writes the diagnostic message at the `Error` level with correlation ID. Creates and returns the exception of given type
[FatalCorr<TException>(string, string, Exception) (Method)](#m-net.adamec.lib.common.logging.loggerext.fatalcorr--1_system.string-system.string-system.exception___w1l5gt)
Writes the diagnostic message at the `Fatal` level with correlation ID. Creates and returns the exception of given type
[ErrorFltrCorr<TException>(string, LoggerExt.TException, string, bool) (Method)](#m-net.adamec.lib.common.logging.loggerext.errorfltrcorr--1_system.string---0-system.string-system.boolean___84xqu8)
Writes the diagnostic message at the `Error` level and returns the exception of given type
[FatalFltrCorr<TException>(string, LoggerExt.TException, string, bool) (Method)](#m-net.adamec.lib.common.logging.loggerext.fatalfltrcorr--1_system.string---0-system.string-system.boolean___15t2hh0)
Writes the diagnostic message at the `Fatal` level and returns catchIt value.
[LogIt(LogLevel, string, string, Exception, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.logit_nlog.loglevel-system.string-system.string-system.exception-system.string___14n4i77)
Writes the item (message with optional exception) with correlation Id into the log
[LoggerExt (Type)](#t-net.adamec.lib.common.logging.loggerext__ac9km2)
Extended logger implementing [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
[CreateException<TException>(string, string, Exception) (Method)](#m-net.adamec.lib.common.logging.loggerext.createexception--1_system.string-system.string--system.exception___1kt7m7i)
Writes the diagnostic message at the `Fatal` level. Creates and returns the exception of given type
[LogIt(LogLevel, string, Exception, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.logit_nlog.loglevel-system.string-system.exception-system.string___17r766x)
Writes the item (message with optional exception) into the log
[LogIt(LogLevel, Dictionary<string,object>, string, Exception, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.logit_nlog.loglevel-system.collections.generic.dictionary_system.string-system.object_-system.string-system.exception-system.string___vo1jng)
Writes the item (message with optional event properties and exception) into the log
[LoggerExt (Type)](#t-net.adamec.lib.common.logging.loggerext__ac9km2)
Extended logger implementing [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
[Trace(Dictionary<string,object>, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.trace_system.collections.generic.dictionary_system.string-system.object_-system.string___1k5wn70)
Writes the diagnostic message at the `Trace` level.
[Debug(Dictionary<string,object>, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.debug_system.collections.generic.dictionary_system.string-system.object_-system.string___by66ma)
Writes the diagnostic message at the `Debug` level.
[Info(Dictionary<string,object>, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.info_system.collections.generic.dictionary_system.string-system.object_-system.string___1qxds6b)
Writes the diagnostic message at the `Info` level.
[Warn(Dictionary<string,object>, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.warn_system.collections.generic.dictionary_system.string-system.object_-system.string___wuc2dz)
Writes the diagnostic message at the `Warn` level.
[Error(Dictionary<string,object>, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.error_system.collections.generic.dictionary_system.string-system.object_-system.string___u5pc5h)
Writes the diagnostic message at the `Error` level.
[Fatal(Dictionary<string,object>, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.fatal_system.collections.generic.dictionary_system.string-system.object_-system.string___1ff2uef)
Writes the diagnostic message at the `Fatal` level.
[Warn(Dictionary<string,object>, Exception, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.warn_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___8kyvvj)
Writes the diagnostic message at the `Warn` level.
[Error(Dictionary<string,object>, Exception, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.error_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___7fy00h)
Writes the diagnostic message at the `Error` level.
[Fatal(Dictionary<string,object>, Exception, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.fatal_system.collections.generic.dictionary_system.string-system.object_-system.exception-system.string___pw9hcn)
Writes the diagnostic message at the `Fatal` level.
[LoggerExt (Type)](#t-net.adamec.lib.common.logging.loggerext__ac9km2)
Extended logger implementing [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
[ErrorFltr<TException>(LoggerExt.TException, string, bool) (Method)](#m-net.adamec.lib.common.logging.loggerext.errorfltr--1_--0-system.string-system.boolean___ipfsfa)
Writes the diagnostic message at the `Error` level and returns the exception of given type
[FatalFltr<TException>(LoggerExt.TException, string, bool) (Method)](#m-net.adamec.lib.common.logging.loggerext.fatalfltr--1_--0-system.string-system.boolean___5rdjqe)
Writes the diagnostic message at the `Fatal` level and returns catchIt value.
[LoggerExt (Type)](#t-net.adamec.lib.common.logging.loggerext__ac9km2)
Extended logger implementing [ILogger](#t-net.adamec.lib.common.logging.ilogger__y2ollm)
[ErrorPassThrough(Exception, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.errorpassthrough_system.exception-system.string___1ey2kd0)
Writes the diagnostic message at the `Error` level and returns given exception
[FatalPassThrough(Exception, string) (Method)](#m-net.adamec.lib.common.logging.loggerext.fatalpassthrough_system.exception-system.string___10psm2o)
Writes the diagnostic message at the `Fatal` level and returns given exception >
[Error<TException>(string, Exception) (Method)](#m-net.adamec.lib.common.logging.loggerext.error--1_system.string-system.exception___1qowqgx)
Writes the diagnostic message at the `Error` level. Creates and returns the exception of given type
[Fatal<TException>(string, Exception) (Method)](#m-net.adamec.lib.common.logging.loggerext.fatal--1_system.string-system.exception___1myw0tj)
Writes the diagnostic message at the `Fatal` level. Creates and returns the exception of given type
- - -Sources
logging\_SourceOnlyPackage.cs
logging\CommonLogging.cs
logging\ILogger.CorrelationId.cs
logging\ILogger.cs
logging\ILogger.EventProperties.cs
logging\ILogger.ExceptionFilter.cs
logging\ILogger.ExceptionPassThrough.cs
logging\LoggerExt.CorrelationId.cs
logging\LoggerExt.cs
logging\LoggerExt.EventProperties.cs
logging\LoggerExt.ExceptionFilter.cs
logging\LoggerExt.ExceptionPassThrough.cs
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - ## RadCommons.utils.BackgroundWorkerWithSyncCancel Source only package ## Tags: RadCommons source-only worker background-worker Includes: None @@ -10425,39 +6998,6 @@ Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adame -## RadCommons.utils.BaseDisposable Source only package ## -Tags: RadCommons source-only disposable -Includes: None -Declaring file: utils\BaseDisposable.cs - - -Helper class for implementation of IDisposable types (Source only package). - - -Package members
[BaseDisposable (Type)](#t-net.adamec.lib.common.utils.basedisposable__7s72ps)
Helper class for implementation of System.IDisposable types
[DisposedFlag (Field)](#f-net.adamec.lib.common.utils.basedisposable.disposedflag__1kqq0uz)
Internal flag whether the object is fully disposed
[isDisposed (Field)](#f-net.adamec.lib.common.utils.basedisposable.isdisposed__2u766d)
The object is disposed when equals to [DisposedFlag](#f-net.adamec.lib.common.utils.basedisposable.disposedflag__1kqq0uz)
[Disposed (Property)](#p-net.adamec.lib.common.utils.basedisposable.disposed__nxq2fp)
Returns -```csharp -true -``` - when the object is fully disposed
[DisposedManaged (Property)](#p-net.adamec.lib.common.utils.basedisposable.disposedmanaged__1pm7df6)
Returns -```csharp -true -``` - when the managed resources are disposed
[DisposedNative (Property)](#p-net.adamec.lib.common.utils.basedisposable.disposednative__fqjn7i)
Returns -```csharp -true -``` - when the native resources are disposed
[Dispose() (Method)](#m-net.adamec.lib.common.utils.basedisposable.dispose__6qe9ri)
Dispose the object
[Dispose(bool) (Method)](#m-net.adamec.lib.common.utils.basedisposable.dispose_system.boolean___1vzs8w4)
Internal implementation of dispose - free the managed and native resources using the respective methods
[DisposeManaged() (Method)](#m-net.adamec.lib.common.utils.basedisposable.disposemanaged__1ht3p85)
Dispose any disposable managed fields or properties.
[DisposeNative() (Method)](#m-net.adamec.lib.common.utils.basedisposable.disposenative__uaa3i9)
Dispose of COM objects, Handles, etc. Then set those objects to null.
[~BaseDisposable() (Method)](#m-net.adamec.lib.common.utils.basedisposable.finalize__1l3n8dl)
[AssertNotDisposed(string) (Method)](#m-net.adamec.lib.common.utils.basedisposable.assertnotdisposed_system.string___18xs7ya)
Throws an System.ObjectDisposedException when the current object is disposed
- - -Sources
utils\BaseDisposable.cs
- - -Go to [namespaces](net.adamec.lib.common.md#namespace-list) or [types](net.adamec.lib.common.md#type-list) or [source-only packages](net.adamec.lib.common.md#package-list) - - - - - ## RadCommons.utils.ConsoleUtils Source only package ## Tags: RadCommons source-only console Includes: None @@ -10497,7 +7037,10 @@ The runtime "container" for context operations. The context can be both state-l (Source only package). -Usings
[RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable)
[RadCommons.utils.Disposer](#src-only-package--RadCommons.utils.Disposer)
+Usings
[RadCommons.utils.Disposer](#src-only-package--RadCommons.utils.Disposer)
+ + +References needed
RadCommons.core
### Remarks ### @@ -10531,7 +7074,7 @@ Declaring file: utils\Disposer.cs
Keeps the stack of disposable objects, and disposes them when the disposer is being disposed. (Source only package). -Usings
[RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable)
+References needed
RadCommons.core
Package members
[Disposer (Type)](#t-net.adamec.lib.common.utils.disposer__1ejr99q)
Keeps the stack of disposable objects, and disposes them when the disposer is being disposed.
[disposables (Field)](#f-net.adamec.lib.common.utils.disposer.disposables__5cwehn)
Stack of disposables kept by the [Disposer](#t-net.adamec.lib.common.utils.disposer__1ejr99q) .
[lockObj (Field)](#f-net.adamec.lib.common.utils.disposer.lockobj__1oj1wh6)
Lock object
[Dispose(bool) (Method)](#m-net.adamec.lib.common.utils.disposer.dispose_system.boolean___32o7wm)
Internal implementation of dispose - free the managed and native resources.
[Add(IDisposable) (Method)](#m-net.adamec.lib.common.utils.disposer.add_system.idisposable___1c4uk8l)
Adds the disposable object to the disposer.
@@ -10665,7 +7208,10 @@ The runtime "container" for scoped operations. The scope can be both state-less (Source only package). -Usings
[RadCommons.utils.BaseDisposable](#src-only-package--RadCommons.utils.BaseDisposable)
[RadCommons.utils.Disposer](#src-only-package--RadCommons.utils.Disposer)
+Usings
[RadCommons.utils.Disposer](#src-only-package--RadCommons.utils.Disposer)
+ + +References needed
RadCommons.core
### Remarks ### diff --git a/net.adamec.lib.common/config/Configuration.cs b/net.adamec.lib.common.core/config/Configuration.cs similarity index 97% rename from net.adamec.lib.common/config/Configuration.cs rename to net.adamec.lib.common.core/config/Configuration.cs index 495079e..0bc413d 100644 --- a/net.adamec.lib.common/config/Configuration.cs +++ b/net.adamec.lib.common.core/config/Configuration.cs @@ -9,7 +9,7 @@ using Environment = System.Environment; using InvalidCastException = System.InvalidCastException; -namespace net.adamec.lib.common.config +namespace net.adamec.lib.common.core.config { /// /// Singleton holding the application configuration (options) @@ -73,12 +73,6 @@ namespace net.adamec.lib.common.config /// then it from the cache when needed. /// /// - /// RadCommons.config.Configuration - /// Simple configuration container in case DI with more sophisticated containers is not used. Supports the JSON config files, command line arguments - /// and environment variables as sources and their hierarchy/overrides. The configuration can be used as key-value pairs or bound to objects (Source only package). - /// RadCommons source-only configuration - /// - /// public sealed class Configuration { #region Singleton diff --git a/net.adamec.lib.common/config/Configuration.cs.partnuspec b/net.adamec.lib.common.core/config/Configuration.cs.partnuspec similarity index 86% rename from net.adamec.lib.common/config/Configuration.cs.partnuspec rename to net.adamec.lib.common.core/config/Configuration.cs.partnuspec index c328c5c..c43b0e6 100644 --- a/net.adamec.lib.common/config/Configuration.cs.partnuspec +++ b/net.adamec.lib.common.core/config/Configuration.cs.partnuspec @@ -7,9 +7,6 @@ - - - diff --git a/net.adamec.lib.common/logging/CommonLogging.cs b/net.adamec.lib.common.core/logging/CommonLogging.cs similarity index 90% rename from net.adamec.lib.common/logging/CommonLogging.cs rename to net.adamec.lib.common.core/logging/CommonLogging.cs index 1bf62b4..13af0a3 100644 --- a/net.adamec.lib.common/logging/CommonLogging.cs +++ b/net.adamec.lib.common.core/logging/CommonLogging.cs @@ -1,12 +1,13 @@ using System; using NLog; -namespace net.adamec.lib.common.logging +namespace net.adamec.lib.common.core.logging { /// /// factory /// - internal static class CommonLogging + // ReSharper disable once PartialTypeWithSinglePart + public static class CommonLogging { /// /// Creates the logger with given diff --git a/net.adamec.lib.common/logging/ILogger.CorrelationId.cs b/net.adamec.lib.common.core/logging/ILogger.CorrelationId.cs similarity index 99% rename from net.adamec.lib.common/logging/ILogger.CorrelationId.cs rename to net.adamec.lib.common.core/logging/ILogger.CorrelationId.cs index b06beb9..2d7e134 100644 --- a/net.adamec.lib.common/logging/ILogger.CorrelationId.cs +++ b/net.adamec.lib.common.core/logging/ILogger.CorrelationId.cs @@ -1,12 +1,12 @@ using System; using System.ComponentModel; -namespace net.adamec.lib.common.logging +namespace net.adamec.lib.common.core.logging { /// /// Logger interface - wrapper around the with some additional methods /// - internal partial interface ILogger + public partial interface ILogger { /// /// Writes the diagnostic message at the Trace level with correlation ID. diff --git a/net.adamec.lib.common/logging/ILogger.EventProperties.cs b/net.adamec.lib.common.core/logging/ILogger.EventProperties.cs similarity index 97% rename from net.adamec.lib.common/logging/ILogger.EventProperties.cs rename to net.adamec.lib.common.core/logging/ILogger.EventProperties.cs index 09dd995..b0824f5 100644 --- a/net.adamec.lib.common/logging/ILogger.EventProperties.cs +++ b/net.adamec.lib.common.core/logging/ILogger.EventProperties.cs @@ -2,12 +2,12 @@ using System.Collections.Generic; using System.ComponentModel; -namespace net.adamec.lib.common.logging +namespace net.adamec.lib.common.core.logging { /// /// Logger interface - wrapper around the with some additional methods /// - internal partial interface ILogger + public partial interface ILogger { /// /// Writes the diagnostic message at the Trace level. diff --git a/net.adamec.lib.common/logging/ILogger.ExceptionFilter.cs b/net.adamec.lib.common.core/logging/ILogger.ExceptionFilter.cs similarity index 97% rename from net.adamec.lib.common/logging/ILogger.ExceptionFilter.cs rename to net.adamec.lib.common.core/logging/ILogger.ExceptionFilter.cs index acdcad9..b07ad6a 100644 --- a/net.adamec.lib.common/logging/ILogger.ExceptionFilter.cs +++ b/net.adamec.lib.common.core/logging/ILogger.ExceptionFilter.cs @@ -1,11 +1,11 @@ using System; -namespace net.adamec.lib.common.logging +namespace net.adamec.lib.common.core.logging { /// /// Logger interface - wrapper around the with some additional methods /// - internal partial interface ILogger + public partial interface ILogger { /// /// Writes the diagnostic message at the Error level and returns the exception of given type diff --git a/net.adamec.lib.common/logging/ILogger.ExceptionPassThrough.cs b/net.adamec.lib.common.core/logging/ILogger.ExceptionPassThrough.cs similarity index 96% rename from net.adamec.lib.common/logging/ILogger.ExceptionPassThrough.cs rename to net.adamec.lib.common.core/logging/ILogger.ExceptionPassThrough.cs index 3177b26..7ab3c86 100644 --- a/net.adamec.lib.common/logging/ILogger.ExceptionPassThrough.cs +++ b/net.adamec.lib.common.core/logging/ILogger.ExceptionPassThrough.cs @@ -1,11 +1,11 @@ using System; -namespace net.adamec.lib.common.logging +namespace net.adamec.lib.common.core.logging { /// /// Logger interface - wrapper around the with some additional methods /// - internal partial interface ILogger + public partial interface ILogger { /// /// Writes the diagnostic message at the Error level and returns given diff --git a/net.adamec.lib.common/logging/ILogger.cs b/net.adamec.lib.common.core/logging/ILogger.cs similarity index 97% rename from net.adamec.lib.common/logging/ILogger.cs rename to net.adamec.lib.common.core/logging/ILogger.cs index 537b340..a33c059 100644 --- a/net.adamec.lib.common/logging/ILogger.cs +++ b/net.adamec.lib.common.core/logging/ILogger.cs @@ -1,6 +1,6 @@ using System; -namespace net.adamec.lib.common.logging +namespace net.adamec.lib.common.core.logging { /// /// Logger interface - wrapper around the with some additional methods @@ -85,7 +85,7 @@ namespace net.adamec.lib.common.logging /// Such methods have the name ending with Corr suffix. /// /// - internal partial interface ILogger : NLog.ILogger + public partial interface ILogger : NLog.ILogger { } } \ No newline at end of file diff --git a/net.adamec.lib.common/logging/LoggerExt.CorrelationId.cs b/net.adamec.lib.common.core/logging/LoggerExt.CorrelationId.cs similarity index 96% rename from net.adamec.lib.common/logging/LoggerExt.CorrelationId.cs rename to net.adamec.lib.common.core/logging/LoggerExt.CorrelationId.cs index e5effa9..45b14ee 100644 --- a/net.adamec.lib.common/logging/LoggerExt.CorrelationId.cs +++ b/net.adamec.lib.common.core/logging/LoggerExt.CorrelationId.cs @@ -3,12 +3,12 @@ using System.ComponentModel; using NLog; -namespace net.adamec.lib.common.logging +namespace net.adamec.lib.common.core.logging { /// /// Extended logger implementing /// - internal partial class LoggerExt + public partial class LoggerExt { /// /// Writes the diagnostic message at the Trace level with correlation ID @@ -27,7 +27,6 @@ public void TraceCorr(string correlationId, [Localizable(false)] string message) /// Log message. public void DebugCorr(string correlationId, [Localizable(false)] string message) { - base.Debug("a", "a"); LogIt(LogLevel.Debug, correlationId, message); } @@ -113,7 +112,7 @@ public void FatalCorr(string correlationId, Exception exception, [Localizable(fa /// Pass-through exception public TException ErrorCorr(string correlationId, TException exception, string message = null) where TException : Exception { - LogIt(LogLevel.Error, correlationId,string.IsNullOrWhiteSpace(message) ? exception.Message : message, exception); + LogIt(LogLevel.Error, correlationId, string.IsNullOrWhiteSpace(message) ? exception.Message : message, exception); return exception; } @@ -126,7 +125,7 @@ public TException ErrorCorr(string correlationId, TException excepti /// Pass-through exception public TException FatalCorr(string correlationId, TException exception, string message = null) where TException : Exception { - LogIt(LogLevel.Fatal, correlationId,string.IsNullOrWhiteSpace(message) ? exception.Message : message, exception); + LogIt(LogLevel.Fatal, correlationId, string.IsNullOrWhiteSpace(message) ? exception.Message : message, exception); return exception; } diff --git a/net.adamec.lib.common/logging/LoggerExt.EventProperties.cs b/net.adamec.lib.common.core/logging/LoggerExt.EventProperties.cs similarity index 98% rename from net.adamec.lib.common/logging/LoggerExt.EventProperties.cs rename to net.adamec.lib.common.core/logging/LoggerExt.EventProperties.cs index 96a55bc..fe621db 100644 --- a/net.adamec.lib.common/logging/LoggerExt.EventProperties.cs +++ b/net.adamec.lib.common.core/logging/LoggerExt.EventProperties.cs @@ -3,12 +3,12 @@ using System.ComponentModel; using NLog; -namespace net.adamec.lib.common.logging +namespace net.adamec.lib.common.core.logging { /// /// Extended logger implementing /// - internal partial class LoggerExt + public partial class LoggerExt { /// /// Writes the diagnostic message at the Trace level. diff --git a/net.adamec.lib.common/logging/LoggerExt.ExceptionFilter.cs b/net.adamec.lib.common.core/logging/LoggerExt.ExceptionFilter.cs similarity index 97% rename from net.adamec.lib.common/logging/LoggerExt.ExceptionFilter.cs rename to net.adamec.lib.common.core/logging/LoggerExt.ExceptionFilter.cs index d32b1fa..0419c01 100644 --- a/net.adamec.lib.common/logging/LoggerExt.ExceptionFilter.cs +++ b/net.adamec.lib.common.core/logging/LoggerExt.ExceptionFilter.cs @@ -1,11 +1,11 @@ using System; -namespace net.adamec.lib.common.logging +namespace net.adamec.lib.common.core.logging { /// /// Extended logger implementing /// - internal partial class LoggerExt + public partial class LoggerExt { /// /// Writes the diagnostic message at the Error level and returns the exception of given type diff --git a/net.adamec.lib.common/logging/LoggerExt.ExceptionPassThrough.cs b/net.adamec.lib.common.core/logging/LoggerExt.ExceptionPassThrough.cs similarity index 97% rename from net.adamec.lib.common/logging/LoggerExt.ExceptionPassThrough.cs rename to net.adamec.lib.common.core/logging/LoggerExt.ExceptionPassThrough.cs index 99e6e2e..62ea04b 100644 --- a/net.adamec.lib.common/logging/LoggerExt.ExceptionPassThrough.cs +++ b/net.adamec.lib.common.core/logging/LoggerExt.ExceptionPassThrough.cs @@ -1,12 +1,12 @@ using System; using NLog; -namespace net.adamec.lib.common.logging +namespace net.adamec.lib.common.core.logging { /// /// Extended logger implementing /// - internal partial class LoggerExt + public partial class LoggerExt { /// /// Writes the diagnostic message at the Error level and returns given diff --git a/net.adamec.lib.common/logging/LoggerExt.cs b/net.adamec.lib.common.core/logging/LoggerExt.cs similarity index 97% rename from net.adamec.lib.common/logging/LoggerExt.cs rename to net.adamec.lib.common.core/logging/LoggerExt.cs index 4ff04e2..fd04125 100644 --- a/net.adamec.lib.common/logging/LoggerExt.cs +++ b/net.adamec.lib.common.core/logging/LoggerExt.cs @@ -4,12 +4,12 @@ using System.Diagnostics; using NLog; -namespace net.adamec.lib.common.logging +namespace net.adamec.lib.common.core.logging { /// /// Extended logger implementing /// - internal partial class LoggerExt : Logger, ILogger + public partial class LoggerExt : Logger, ILogger { /// /// Writes the diagnostic message at the Fatal level. Creates and returns the exception of given type diff --git a/net.adamec.lib.common.core/net.adamec.lib.common.core.csproj b/net.adamec.lib.common.core/net.adamec.lib.common.core.csproj new file mode 100644 index 0000000..3594049 --- /dev/null +++ b/net.adamec.lib.common.core/net.adamec.lib.common.core.csproj @@ -0,0 +1,24 @@ + + + + netstandard2.0 + true + RadCommons.core + 7.1 + + + + + + + + + + %(FileName) + + + %(FileName) + + + + diff --git a/net.adamec.lib.common/utils/BaseDisposable.cs b/net.adamec.lib.common.core/utils/BaseDisposable.cs similarity index 79% rename from net.adamec.lib.common/utils/BaseDisposable.cs rename to net.adamec.lib.common.core/utils/BaseDisposable.cs index 33b6ce4..2c240cf 100644 --- a/net.adamec.lib.common/utils/BaseDisposable.cs +++ b/net.adamec.lib.common.core/utils/BaseDisposable.cs @@ -2,21 +2,19 @@ using System.Diagnostics; using System.Threading; -namespace net.adamec.lib.common.utils +namespace net.adamec.lib.common.core.utils { /// /// /// Helper class for implementation of types /// - /// RadCommons.utils.BaseDisposable - /// Helper class for implementation of IDisposable types (Source only package). - /// RadCommons source-only disposable public abstract class BaseDisposable : IDisposable { /// /// Internal flag whether the object is fully disposed /// private const int DisposedFlag = 1; + /// /// The object is disposed when equals to /// @@ -34,14 +32,39 @@ public bool Disposed } } + /// + /// The managed resources are disposed when equals to + /// + private int isManagedDisposed; + /// /// Returns true when the managed resources are disposed /// - public bool DisposedManaged { get; private set; } + public bool DisposedManaged + { + get + { + Interlocked.MemoryBarrier(); + return isManagedDisposed == DisposedFlag; + } + } + + /// + /// The native resources are disposed when equals to + /// + private int isNativeDisposed; + /// /// Returns true when the native resources are disposed /// - public bool DisposedNative { get; private set; } + public bool DisposedNative + { + get + { + Interlocked.MemoryBarrier(); + return isNativeDisposed == DisposedFlag; + } + } /// /// @@ -78,7 +101,7 @@ protected virtual void Dispose(bool disposing) } finally { - DisposedManaged = true; + Interlocked.Exchange(ref isManagedDisposed, DisposedFlag); } } } @@ -97,7 +120,7 @@ protected virtual void Dispose(bool disposing) } finally { - DisposedNative = true; + Interlocked.Exchange(ref isNativeDisposed, DisposedFlag); } } diff --git a/net.adamec.lib.common/utils/BaseDisposable.cs.partnuspec b/net.adamec.lib.common.core/utils/BaseDisposable.cs.partnuspec similarity index 100% rename from net.adamec.lib.common/utils/BaseDisposable.cs.partnuspec rename to net.adamec.lib.common.core/utils/BaseDisposable.cs.partnuspec diff --git a/net.adamec.lib.common/async/AsyncManager.cs b/net.adamec.lib.common/async/AsyncManager.cs index 0e44458..823a74f 100644 --- a/net.adamec.lib.common/async/AsyncManager.cs +++ b/net.adamec.lib.common/async/AsyncManager.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using net.adamec.lib.common.logging; namespace net.adamec.lib.common.async { @@ -12,22 +11,17 @@ namespace net.adamec.lib.common.async /// RadCommons.async.AsyncManager /// Helpers for running the async tasks in sync mode and executing sync actions in async mode (Source only package). /// RadCommons source-only async - /// // ReSharper disable once PartialTypeWithSinglePart internal static partial class AsyncManager { /// - /// Logger - /// - private static readonly ILogger Logger = CommonLogging.CreateLogger(typeof(AsyncManager)); - - /// - /// Default exception handler for . Catches and logs all exceptions during the task execution. + /// Default exception handler for . Catches all exceptions during the task execution. /// private static readonly Action DefaultExceptionHandler = task => { try { task.Wait(); } - catch (Exception e) { Logger.Fatal(e, $"Async call finished with expception {e}"); } + // ReSharper disable once EmptyGeneralCatchClause + catch (Exception) { } }; /// @@ -39,7 +33,7 @@ internal static partial class AsyncManager /// is null public static Task RunAsync(Action action, Action exceptionHandler = null) { - if (action == null) throw Logger.Fatal(nameof(action)); + if (action == null) throw new ArgumentNullException(nameof(action)); var task = new Task(action); @@ -64,7 +58,7 @@ public static Task RunAsync(Action action, Action exceptionHandler = /// is null public static void RunSync(Func task) { - if (task == null) throw Logger.Fatal(nameof(task)); + if (task == null) throw new ArgumentNullException(nameof(task)); var oldContext = SynchronizationContext.Current; var synch = new ExclusiveSynchronizationContext(); @@ -99,7 +93,7 @@ public static void RunSync(Func task) /// is null public static T RunSync(Func> task) { - if (task == null) throw Logger.Fatal(nameof(task)); + if (task == null) throw new ArgumentNullException(nameof(task)); var oldContext = SynchronizationContext.Current; var synch = new ExclusiveSynchronizationContext(); diff --git a/net.adamec.lib.common/async/AsyncManager.cs.partnuspec b/net.adamec.lib.common/async/AsyncManager.cs.partnuspec index 2329d6d..c9cde88 100644 --- a/net.adamec.lib.common/async/AsyncManager.cs.partnuspec +++ b/net.adamec.lib.common/async/AsyncManager.cs.partnuspec @@ -6,9 +6,6 @@ - - - diff --git a/net.adamec.lib.common/di/component/ContainerBuilderExtensions.cs b/net.adamec.lib.common/di/component/ContainerBuilderExtensions.cs index 1ac252a..7ca12ff 100644 --- a/net.adamec.lib.common/di/component/ContainerBuilderExtensions.cs +++ b/net.adamec.lib.common/di/component/ContainerBuilderExtensions.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics; using System.Linq; using System.Reflection; using Autofac; diff --git a/net.adamec.lib.common/di/component/_SourceOnlyPackage.cs b/net.adamec.lib.common/di/component/_SourceOnlyPackage.cs index 8f84d54..ded5dc1 100644 --- a/net.adamec.lib.common/di/component/_SourceOnlyPackage.cs +++ b/net.adamec.lib.common/di/component/_SourceOnlyPackage.cs @@ -6,8 +6,6 @@ namespace net.adamec.lib.common.di.component /// RadCommons DI Component - allows to mark and inject the component using the class attributes (Source only package). /// RadCommons source-only RadCommons-DI dependency-injection components /// - /// - /// /// [CompilerGenerated] // ReSharper disable once InconsistentNaming diff --git a/net.adamec.lib.common/di/component/_SourceOnlyPackage.cs.partnuspec b/net.adamec.lib.common/di/component/_SourceOnlyPackage.cs.partnuspec index adc21ff..0270e67 100644 --- a/net.adamec.lib.common/di/component/_SourceOnlyPackage.cs.partnuspec +++ b/net.adamec.lib.common/di/component/_SourceOnlyPackage.cs.partnuspec @@ -6,10 +6,6 @@ - - - - diff --git a/net.adamec.lib.common/di/config/extensions/ServiceCollectionAutoOptionsExtension.cs b/net.adamec.lib.common/di/config/extensions/ServiceCollectionAutoOptionsExtension.cs index 489ffb9..4e79e52 100644 --- a/net.adamec.lib.common/di/config/extensions/ServiceCollectionAutoOptionsExtension.cs +++ b/net.adamec.lib.common/di/config/extensions/ServiceCollectionAutoOptionsExtension.cs @@ -1,9 +1,9 @@ using System; +using System.Diagnostics; using System.Reflection; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using net.adamec.lib.common.di.config.exception; -using net.adamec.lib.common.logging; namespace net.adamec.lib.common.di.config.extensions { @@ -13,8 +13,6 @@ namespace net.adamec.lib.common.di.config.extensions // ReSharper disable once PartialTypeWithSinglePart internal static partial class ServiceCollectionAutoOptionsExtension { - private static readonly ILogger Logger = CommonLogging.CreateLogger(typeof(ServiceCollectionAutoOptionsExtension)); - /// /// Scans given assemblies for classes marked with and binds them to appsettings.json configuration section defined in attribute. /// Optionally (if defined in attribute), an instance or the configuration class can be created and registered as singleton into MS DI @@ -49,7 +47,7 @@ public static IServiceCollection ConfigureAutoOptions(this IServiceCollection se catch (Exception ex) when (ex is AmbiguousMatchException || ex is TypeLoadException) { //do nothing - Logger.Warn(ex, $"Can't get the AutoOptionsAttribute. {ex.Message}"); + Debug.WriteLine($"Can't get the AutoOptionsAttribute. {ex.Message}"); } @@ -73,9 +71,8 @@ ex is ArgumentException || ex is InvalidOperationException || ex is NotSupportedException) { - //log and rethrow + //rethrow var msg = $"Can't invoke 'services.Configure<{type.Name}>({section})'. {ex.Message}"; - Logger.Warn(ex, msg); throw new ServiceCollectionAutoOptionsException(msg, ex); } @@ -125,7 +122,7 @@ public static IServiceCollection ConfigureAutoOptions(this IServiceCollection se catch (Exception ex) when (ex is AmbiguousMatchException || ex is TypeLoadException) { //do nothing - Logger.Warn(ex, $"Can't get the AutoOptionsAttribute. {ex.Message}"); + Debug.WriteLine($"Can't get the AutoOptionsAttribute. {ex.Message}"); } @@ -149,9 +146,8 @@ ex is ArgumentException || ex is InvalidOperationException || ex is NotSupportedException) { - //log and rethrow + //rethrow var msg = $"Can't invoke 'services.Configure<{type.Name}>({section})'. {ex.Message}"; - Logger.Warn(ex, msg); throw new ServiceCollectionAutoOptionsException(msg, ex); } diff --git a/net.adamec.lib.common/di/postinit/ContainerBuilderExtensions.cs b/net.adamec.lib.common/di/postinit/ContainerBuilderExtensions.cs index 7beadfc..97fee8c 100644 --- a/net.adamec.lib.common/di/postinit/ContainerBuilderExtensions.cs +++ b/net.adamec.lib.common/di/postinit/ContainerBuilderExtensions.cs @@ -6,7 +6,6 @@ using Autofac.Core; using Autofac.Core.Lifetime; using net.adamec.lib.common.di.component; -using net.adamec.lib.common.logging; namespace net.adamec.lib.common.di.postinit { @@ -16,11 +15,6 @@ namespace net.adamec.lib.common.di.postinit // ReSharper disable once PartialTypeWithSinglePart internal static partial class ContainerBuilderExtensions { - /// - /// Logger - /// - private static readonly ILogger Logger = CommonLogging.CreateLogger(typeof(ContainerBuilderExtensions)); - /// /// Adds the support of to the Autofac container builder. /// @@ -53,10 +47,6 @@ private static void ProcessComponentPostInit(IContainer container) foreach (var componentRegistration in container.ComponentRegistry.Registrations) { var type = componentRegistration.Activator.LimitType; - if (Logger.IsDebugEnabled) - { - Logger.Debug($"ProcessComponentPostInit - checking registration of type '{type.FullName}'"); - } if (!(componentRegistration.Lifetime is RootScopeLifetime)) continue; //must be singleton @@ -72,12 +62,6 @@ private static void ProcessComponentPostInit(IContainer container) var componentAttribute = type.GetTypeInfo().GetCustomAttribute(false); if (componentAttribute == null) continue; //must have component attribute - if (Logger.IsDebugEnabled) - { - Logger.Debug( - $"ProcessComponentPostInit - registration of type '{type.FullName}' is self registered singleton with Component attribute. Checking for PostInit attribute"); - } - //has Component attribute, check if has any method with PostInit attribute and get the first one foreach (var method in type.GetMethods()) { @@ -85,31 +69,17 @@ private static void ProcessComponentPostInit(IContainer container) if (postInitAttribute == null) continue; //has postinit attribute - try to inject parameters - if (Logger.IsDebugEnabled) - { - Logger.Debug( - $"ProcessComponentPostInit - type '{type.FullName}' has post init method '{method.Name}'"); - } - var parameterValues = new List(); foreach (var parameter in method.GetParameters()) { var parameterType = parameter.ParameterType; if (container.TryResolve(parameterType, out object valueToInject)) { - if (Logger.IsDebugEnabled) - { - Logger.Debug( - $"ProcessComponentPostInit - resolved parameter {parameter.Name} of type {parameterType.FullName} for post init method '{method.Name}' of type '{type.FullName}'"); - } - parameterValues.Add(valueToInject); } else { - var msg = - $"ProcessComponentPostInit - can't resolve parameter {parameter.Name} of type {parameterType.FullName} for post init method '{method.Name}' of type '{type.FullName}'"; - Logger.Fatal(msg); + var msg = $"ProcessComponentPostInit - can't resolve parameter {parameter.Name} of type {parameterType.FullName} for post init method '{method.Name}' of type '{type.FullName}'"; throw new Exception(msg); } } @@ -117,25 +87,11 @@ private static void ProcessComponentPostInit(IContainer container) //invoke if (container.TryResolve(type, out object componentInstance)) { - if (Logger.IsDebugEnabled) - { - Logger.Debug( - $"ProcessComponentPostInit - invoking post init method '{method.Name}' of type '{type.FullName}'"); - } - method.Invoke(componentInstance, parameterValues.ToArray()); - - if (Logger.IsDebugEnabled) - { - Logger.Debug( - $"ProcessComponentPostInit - invoked post init method '{method.Name}' of type '{type.FullName}'"); - } } else { - var msg = - $"ProcessComponentPostInit - can't resolve component of type '{type.FullName}' for invoking the post init method '{method.Name}' "; - Logger.Fatal(msg); + var msg =$"ProcessComponentPostInit - can't resolve component of type '{type.FullName}' for invoking the post init method '{method.Name}' "; throw new Exception(msg); } diff --git a/net.adamec.lib.common/di/postinit/_SourceOnlyPackage.cs b/net.adamec.lib.common/di/postinit/_SourceOnlyPackage.cs index 37e5317..2841c21 100644 --- a/net.adamec.lib.common/di/postinit/_SourceOnlyPackage.cs +++ b/net.adamec.lib.common/di/postinit/_SourceOnlyPackage.cs @@ -6,7 +6,6 @@ namespace net.adamec.lib.common.di.postinit /// RadCommons DI PostInit - allows to run post init method of component (Source only package). /// RadCommons source-only RadCommons-DI dependency-injection post-init /// - /// /// /// [CompilerGenerated] diff --git a/net.adamec.lib.common/di/postinit/_SourceOnlyPackage.cs.partnuspec b/net.adamec.lib.common/di/postinit/_SourceOnlyPackage.cs.partnuspec index c369816..12f502b 100644 --- a/net.adamec.lib.common/di/postinit/_SourceOnlyPackage.cs.partnuspec +++ b/net.adamec.lib.common/di/postinit/_SourceOnlyPackage.cs.partnuspec @@ -7,7 +7,6 @@ - diff --git a/net.adamec.lib.common/logging/_SourceOnlyPackage.cs b/net.adamec.lib.common/logging/_SourceOnlyPackage.cs deleted file mode 100644 index 6747629..0000000 --- a/net.adamec.lib.common/logging/_SourceOnlyPackage.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Runtime.CompilerServices; - -namespace net.adamec.lib.common.logging -{ - /// RadCommons.logging.CommonLogging - /// RadCommons logging wrapper around NLog with some extended functionality (Source only package). - /// RadCommons source-only logging NLog - /// - /// - /// - [CompilerGenerated] - // ReSharper disable once InconsistentNaming - internal class _SourceOnlyPackage - { - } -} diff --git a/net.adamec.lib.common/logging/_SourceOnlyPackage.cs.partnuspec b/net.adamec.lib.common/logging/_SourceOnlyPackage.cs.partnuspec deleted file mode 100644 index 4da9583..0000000 --- a/net.adamec.lib.common/logging/_SourceOnlyPackage.cs.partnuspec +++ /dev/null @@ -1,36 +0,0 @@ - - - RadCommons.logging.CommonLogging - RadCommons logging wrapper around NLog with some extended functionality (Source only package). - RadCommons source-only logging NLog - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/net.adamec.lib.common/net.adamec.lib.common.csproj b/net.adamec.lib.common/net.adamec.lib.common.csproj index 5f818ed..94eeef1 100644 --- a/net.adamec.lib.common/net.adamec.lib.common.csproj +++ b/net.adamec.lib.common/net.adamec.lib.common.csproj @@ -23,14 +23,17 @@ - - + + - - + + + + + diff --git a/net.adamec.lib.common/utils/Context.cs b/net.adamec.lib.common/utils/Context.cs index 41e600f..87e681e 100644 --- a/net.adamec.lib.common/utils/Context.cs +++ b/net.adamec.lib.common/utils/Context.cs @@ -1,5 +1,6 @@ using System; using System.Threading; +using net.adamec.lib.common.core.utils; namespace net.adamec.lib.common.utils { @@ -38,8 +39,8 @@ namespace net.adamec.lib.common.utils /// Based on the implementation of Guard Scopes by https://github.com/safakgur. /// (Source only package). /// RadCommons source-only disposable context - /// /// + /// /// internal class Context : BaseDisposable where TState : class, new() { diff --git a/net.adamec.lib.common/utils/Context.cs.partnuspec b/net.adamec.lib.common/utils/Context.cs.partnuspec index 2114c80..c97d131 100644 --- a/net.adamec.lib.common/utils/Context.cs.partnuspec +++ b/net.adamec.lib.common/utils/Context.cs.partnuspec @@ -16,7 +16,6 @@ - diff --git a/net.adamec.lib.common/utils/Disposer.cs b/net.adamec.lib.common/utils/Disposer.cs index dac6e3e..a1b1687 100644 --- a/net.adamec.lib.common/utils/Disposer.cs +++ b/net.adamec.lib.common/utils/Disposer.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using net.adamec.lib.common.core.utils; namespace net.adamec.lib.common.utils { @@ -9,7 +10,7 @@ namespace net.adamec.lib.common.utils /// RadCommons.utils.Disposer /// Keeps the stack of disposable objects, and disposes them when the disposer is being disposed. (Source only package). /// RadCommons source-only disposable - /// + /// internal class Disposer : BaseDisposable { /// diff --git a/net.adamec.lib.common/utils/Disposer.cs.partnuspec b/net.adamec.lib.common/utils/Disposer.cs.partnuspec index 5b79ee7..8c70cc5 100644 --- a/net.adamec.lib.common/utils/Disposer.cs.partnuspec +++ b/net.adamec.lib.common/utils/Disposer.cs.partnuspec @@ -6,9 +6,6 @@ - - - diff --git a/net.adamec.lib.common/utils/Scope.cs b/net.adamec.lib.common/utils/Scope.cs index fe3c757..90581f0 100644 --- a/net.adamec.lib.common/utils/Scope.cs +++ b/net.adamec.lib.common/utils/Scope.cs @@ -1,4 +1,5 @@ using System; +using net.adamec.lib.common.core.utils; namespace net.adamec.lib.common.utils { @@ -14,8 +15,8 @@ namespace net.adamec.lib.common.utils /// to add the scope related operations (inherited classes have the access to state). /// (Source only package). /// RadCommons source-only disposable scope - /// /// + /// /// internal interface IScope : IDisposable where TState: class,new() { diff --git a/net.adamec.lib.common/utils/Scope.cs.partnuspec b/net.adamec.lib.common/utils/Scope.cs.partnuspec index 71e0092..3b533ba 100644 --- a/net.adamec.lib.common/utils/Scope.cs.partnuspec +++ b/net.adamec.lib.common/utils/Scope.cs.partnuspec @@ -12,7 +12,6 @@ - diff --git a/readme.md b/readme.md index 27e4646..4743b73 100644 --- a/readme.md +++ b/readme.md @@ -7,6 +7,17 @@ Long story short: source-only NuGet packages are the libraries providing the sou ## Build ## The Commons library use the customized MS Build process allowing to create and publish the source-only packages. Details about the build process are described in [build documentation](build/readme.md). +## RadCommons.core Package ## +Based on the experience and problems I faced in real-life use, I created nuget package `RadCommons.core` containing `BaseDisposable` class, `Configuration` class and logging. These parts are no longer available as source-only packages mainly due to a `public` members and/or limitations of having them as `internal` (problems with inheritance in consuming code). +This nuget package is needed by some of the source-only packages. + + | Name | Summary | + | ------ | --------- | + | [Configuration](doc/net.adamec.lib.common.core.md#t-net.adamec.lib.common.core.config.configuration__1akk3r9) | Simple configuration container in case DI with more sophisticated containers is not used. Supports the JSON config files, command line arguments and environment variables as sources and their hierarchy/overrides. The configuration can be used as key-value pairs or bound to objects. | + | [CommonLogging](doc/net.adamec.lib.common.core#t-net.adamec.lib.common.core.logging.ilogger__pion8h) | RadCommons logging wrapper around NLog with some extended functionality. | + | [BaseDisposable](doc/net.adamec.lib.common.core#t-net.adamec.lib.common.core.utils.basedisposable__mdk3wh) | Helper class for implementation of IDisposable types. | + + ## Packages ## The brief of the packages is described here, for more details see the [code documentation](doc/net.adamec.lib.common.md) generated by [MarkupDoc](https://github.com/adamecr/MarkupDoc). @@ -15,7 +26,6 @@ The brief of the packages is described here, for more details see the [code docu | ------ | --------- | | [RadCommons.async.AsyncManager](doc/net.adamec.lib.common.md#src-only-package--RadCommons.async.AsyncManager) | Helpers for running the async tasks in sync mode and executing sync actions in async mode. | | [RadCommons.async.FileAsync](doc/net.adamec.lib.common.md#src-only-package--RadCommons.async.FileAsync) | Helpers for reading text files in async mode. | - | [RadCommons.config.Configuration](doc/net.adamec.lib.common.md#src-only-package--RadCommons.config.Configuration) | Simple configuration container in case DI with more sophisticated containers is not used. Supports the JSON config files, command line arguments and environment variables as sources and their hierarchy/overrides. The configuration can be used as key-value pairs or bound to objects. | | [RadCommons.di.Component](doc/net.adamec.lib.common.md#src-only-package--RadCommons.di.Component) | RadCommons DI Component - allows to mark and inject the component using the class attributes. | | [RadCommons.di.Config](doc/net.adamec.lib.common.md#src-only-package--RadCommons.di.Config) | RadCommons DI helpers for application configuration. | | [RadCommons.di.PostInit](doc/net.adamec.lib.common.md#src-only-package--RadCommons.di.PostInit) | RadCommons DI PostInit - allows to run post init method of component. | @@ -29,9 +39,7 @@ The brief of the packages is described here, for more details see the [code docu | [RadCommons.extensions.StringExtensions.Paths](doc/net.adamec.lib.common.md#src-only-package--RadCommons.extensions.StringExtensions.Paths) | Path manipulation helpers for strings. | | [RadCommons.extensions.StringExtensions.Whitespace](doc/net.adamec.lib.common.md#src-only-package--RadCommons.extensions.StringExtensions.Whitespace) | Whitespace manipulation helpers for strings. | | [RadCommons.extensions.TypeExtensions.DefaultValue](doc/net.adamec.lib.common.md#src-only-package--RadCommons.extensions.TypeExtensions.DefaultValue) | Provides default value for types. | - | [RadCommons.logging.CommonLogging](doc/net.adamec.lib.common.md#src-only-package--RadCommons.logging.CommonLogging) | RadCommons logging wrapper around NLog with some extended functionality. | | [RadCommons.utils.BackgroundWorkerWithSyncCancel](doc/net.adamec.lib.common.md#src-only-package--RadCommons.utils.BackgroundWorkerWithSyncCancel) | Executes an operation on a separate thread with possibility of sync cancel. | - | [RadCommons.utils.BaseDisposable](doc/net.adamec.lib.common.md#src-only-package--RadCommons.utils.BaseDisposable) | Helper class for implementation of IDisposable types. | | [RadCommons.utils.ConsoleUtils](doc/net.adamec.lib.common.md#src-only-package--RadCommons.utils.ConsoleUtils) | Console output utilities. | | [RadCommons.utils.Context](doc/net.adamec.lib.common.md#src-only-package--RadCommons.utils.Context) | The runtime "container" for context operations. The context can be both state-less and state-full and it's valid until it's disposed. The current context is accessible via static property Current. The contexts are chained, when a new context is created using static method BeginContext(), the Current context became the Parent of the new one and the newly created context will be set as the Current one. When the context is disposed, the Current context is set to Parent of disposing context. The base implementation just manages the life time, context chain and keeps the state (when provided). Inherit from the Context to add the context related operations (inherited classes have the access to state). Based on the implementation of Guard Scopes by https://github.com/safakgur. | | [RadCommons.utils.Disposer](doc/net.adamec.lib.common.md#src-only-package--RadCommons.utils.Disposer) | Keeps the stack of disposable objects, and disposes them when the disposer is being disposed. |

NameModifierSummary