Class SoOperationContext
Hold information about current operation context.
Implements
Namespace: SuperOffice
Assembly: SoCore.dll
Syntax
public class SoOperationContext : Object, IDisposable
Remarks
Clients of NetServer should call
using (SoOperationContext.EnterOperationContext(applicationId, operation)){/* business logic /*}
when performing operations.
Properties
ApplicationToken
ApplicationId of the current context.
Declaration
public string ApplicationToken { get; }
Property Value
| Type | Description |
|---|---|
| String |
Remarks
Clients of NetServer should call
using (SoOperationContext.EnterOperationContext(applicationId, operation)){/* business logic /*}
when performing operations.
IsCurrentContext
Check if this is the current operation context.
Declaration
public bool IsCurrentContext { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Remarks
Clients of NetServer should call
using (SoOperationContext.EnterOperationContext(applicationId, operation)){/* business logic /*}
when performing operations.
Operation
Operation name
Declaration
public string Operation { get; }
Property Value
| Type | Description |
|---|---|
| String |
Remarks
Clients of NetServer should call
using (SoOperationContext.EnterOperationContext(applicationId, operation)){/* business logic /*}
when performing operations.
OperationType
Type of operation
Declaration
public OperationContextType OperationType { get; }
Property Value
| Type | Description |
|---|---|
| OperationContextType |
Remarks
Clients of NetServer should call
using (SoOperationContext.EnterOperationContext(applicationId, operation)){/* business logic /*}
when performing operations.
Parent
Parent operation. This can be null if there are no parent operations.
Declaration
public SoOperationContext Parent { get; }
Property Value
| Type | Description |
|---|---|
| SoOperationContext |
Remarks
Clients of NetServer should call
using (SoOperationContext.EnterOperationContext(applicationId, operation)){/* business logic /*}
when performing operations.
Methods
Dispose()
Dispose the current operation context by calling LeaveOperationContext().
Declaration
public void Dispose()
Remarks
Clients of NetServer should call
using (SoOperationContext.EnterOperationContext(applicationId, operation)){/* business logic /*}
when performing operations.
EnterOperationContext(String, OperationContextType, String)
Called by clients in a using statement surrounding the implementation block of code
Declaration
public static SoOperationContext EnterOperationContext(string applicationToken, OperationContextType type, string operation)
Parameters
| Type | Name | Description |
|---|---|---|
| String | applicationToken | ApplicationID of the caller |
| OperationContextType | type | |
| String | operation | Operation that is performed |
Returns
| Type | Description |
|---|---|
| SoOperationContext | Disposable operation context. |
Remarks
Clients of NetServer should call
using (SoOperationContext.EnterOperationContext(applicationId, operation)){/* business logic /*}
when performing operations.
GetClosestApplicationToken()
Traverse the OperationContext stack from the current level and backup, looking for a non-blank ApplicationToken. Return the first one found, or null if none are found.
Declaration
public static string GetClosestApplicationToken()
Returns
| Type | Description |
|---|---|
| String | ApplicationToken closest in nesting level to the current context; possibly null |
Remarks
Clients of NetServer should call
using (SoOperationContext.EnterOperationContext(applicationId, operation)){/* business logic /*}
when performing operations.
GetCurrentContext()
Get the current operation context.
Declaration
public static SoOperationContext GetCurrentContext()
Returns
| Type | Description |
|---|---|
| SoOperationContext | Current operation context. A new one is created if no-one exists. |
Remarks
Clients of NetServer should call
using (SoOperationContext.EnterOperationContext(applicationId, operation)){/* business logic /*}
when performing operations.
IsApplicationTokenSet()
Check if a non-blank application token has been set
Declaration
public static bool IsApplicationTokenSet()
Returns
| Type | Description |
|---|---|
| Boolean |
Remarks
Clients of NetServer should call
using (SoOperationContext.EnterOperationContext(applicationId, operation)){/* business logic /*}
when performing operations.
LeaveOperationContext()
Leave the operation context. This method is called by Dispose.
Declaration
public void LeaveOperationContext()
Remarks
Clients of NetServer should call
using (SoOperationContext.EnterOperationContext(applicationId, operation)){/* business logic /*}
when performing operations.
Exceptions
| Type | Condition |
|---|---|
| SoException | Thrown if this is not the current context. |
StopTimer()
Hold information about current operation context.
Declaration
public void StopTimer()
Remarks
Clients of NetServer should call
using (SoOperationContext.EnterOperationContext(applicationId, operation)){/* business logic /*}
when performing operations.