ExecutionCallContextProvider Class
Namespace: PTS.Concurrency
Assembly: PTS.Concurrency.dll
Provides static data storage bound to logical call execution context.
Syntax
public static class ExecutionCallContextProvider
Inheritance
Remarks
Default logical data container for the static provider is LocalDataContainer. To change the logical data container use the SetLogicalContainer
method.
Methods
GetItem(String, String)
Retrieves an object with the specified key from internal ILogicalDataContainer.
Declaration
public static object GetItem(string key, string discriminator = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The name of the item in the call context. |
System.String | discriminator | Secondary key component to further differentiate items with the same principal key. |
Returns
Type | Description |
---|---|
System.Object | An object in the call context associated with the specified key and descriminator, or null if not found. |
GetItem<TValue>(String)
Retrieves an object with the specified type from internal ILogicalDataContainer.
Declaration
public static TValue GetItem<TValue>(string discriminator = null)
where TValue : class
Parameters
Type | Name | Description |
---|---|---|
System.String | discriminator | Secondary key component to differentiate items with the same type. |
Returns
Type | Description |
---|---|
TValue | An object in the call context associated with the specified type and descriminator, or null if not found. |
Type Parameters
Name | Description |
---|---|
TValue | Type of value to retrieve. |
GetItem<TValue>(String, String)
Retrieves an object with the specified key from internal ILogicalDataContainer.
Declaration
public static TValue GetItem<TValue>(string key, string discriminator = null)
where TValue : class
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The name of the item in the call context. |
System.String | discriminator | Secondary key component to differentiate items with the same principal key. |
Returns
Type | Description |
---|---|
TValue | An object in the call context associated with the specified key and descriminator, or null if not found. |
Type Parameters
Name | Description |
---|---|
TValue | Type of value to retrieve. |
RemoveItem(String, String)
Removes an object with the specified key from internal ILogicalDataContainer.
Declaration
public static void RemoveItem(string key, string discriminator = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The name of the item in the call context. |
System.String | discriminator | Secondary key component to differentiate items with the same principal key. |
RemoveItem(Type, String)
Removes an object with the specified type from internal ILogicalDataContainer.
Declaration
public static void RemoveItem(Type type, string discriminator = null)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Type of value to remove. |
System.String | discriminator | Secondary key component to differentiate items with the same type. |
RemoveItem<TValue>(String)
Removes an object with the specified type from internal ILogicalDataContainer.
Declaration
public static void RemoveItem<TValue>(string discriminator = null)
where TValue : class
Parameters
Type | Name | Description |
---|---|---|
System.String | discriminator | Secondary key component to differentiate items with the same type. |
Type Parameters
Name | Description |
---|---|
TValue | Type of value to remove. |
SetItem(String, Object, String)
Stores given object and associates it with the specified key.
Declaration
public static void SetItem(string key, object value, string discriminator = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The name of the item in the call context. |
System.Object | value | An object to be associated with the specified type and descriminator in the call context. |
System.String | discriminator | Secondary key component to differentiate items with the same principal key. |
SetItem(Type, Object, String)
Declaration
public static void SetItem(Type type, object value, string discriminator = null)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | |
System.Object | value | |
System.String | discriminator |
SetItem<TValue>(TValue, String)
Stores an object with the specified type in internal ILogicalDataContainer.
Declaration
public static void SetItem<TValue>(TValue value, string discriminator = null)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | An object to be associated with the specified type and descriminator in the call context. |
System.String | discriminator | Secondary key component to differentiate items with the same principal key. |
Type Parameters
Name | Description |
---|---|
TValue | Type of value to add to the call context. |
SetLogicalContainer(ILogicalDataContainer)
Injects execution call context logical container to accomodate different execution environments.
Declaration
public static void SetLogicalContainer(ILogicalDataContainer container)
Parameters
Type | Name | Description |
---|---|---|
ILogicalDataContainer | container | Logica container to be used as backing storage for static accessor methods. |