Class ContextExtensions
A context extensions.
Inheritance
System.Object
ContextExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Kephas.Services
Assembly: Kephas.Core.dll
Syntax
public static class ContextExtensions
Methods
| Improve this Doc View SourceAddResource<TContext>(TContext, IDisposable[])
Registers with the context disposable resources to be disposed together with the context.
Declaration
public static TContext AddResource<TContext>(this TContext context, params IDisposable[] resources)
where TContext : class, IContext
Parameters
Type | Name | Description |
---|---|---|
TContext | context | The context to act on. |
System.IDisposable[] | resources | The resources to add. |
Returns
Type | Description |
---|---|
TContext | The provided context. |
Type Parameters
Name | Description |
---|---|
TContext | Type of the context. |
WithIdentity<TContext>(TContext, IIdentity)
Sets the context identity.
Declaration
public static TContext WithIdentity<TContext>(this TContext context, IIdentity identity)
where TContext : class, IContext
Parameters
Type | Name | Description |
---|---|---|
TContext | context | The context to act on. |
System.Security.Principal.IIdentity | identity | The identity. |
Returns
Type | Description |
---|---|
TContext | This context. |
Type Parameters
Name | Description |
---|---|
TContext | Type of the context. |
WithLogger<TContext>(TContext, ILogger)
Sets the context logger.
Declaration
public static TContext WithLogger<TContext>(this TContext context, ILogger contextLogger)
where TContext : class, IContext
Parameters
Type | Name | Description |
---|---|---|
TContext | context | The context to act on. |
ILogger | contextLogger | The context logger. |
Returns
Type | Description |
---|---|
TContext | This context. |
Type Parameters
Name | Description |
---|---|
TContext | Type of the context. |