The Context Class

The Microsoft.ConnectedIndustry.ServiceModel.Common.Context class provides the default set of properties that a client application can use to specify context. The default scope provider (Microsoft.ConnectedIndustry.ServiceModel.Application.ScopeProvider ) and ranker (Microsoft.ConnectedIndustry.ServiceModel.Application.ScopeRanking ) classes provided with DCS use the default Context class to define the list of scopes for a client request and to order the list of service endpoints returned by the Discovery Service that match these scopes.

The Context class defines the constructors and properties described in the following tables.

Constructors

Name

Description

Context

Overloaded. Initializes a new instance of the Context class.


Three overloads are available:

  • A default constructor that takes no parameters. It initializes the fields in the Context object with default values.
  • A constructor that takes a Context object. The constructor initializes the Context object with the copy of the data provided in the parameter.
  • A constructor that takes the following parameters with the types specified in brackets. The constructor initializes the fields in the Context object with the values specified for these parameters:
    • User (string)
    • Session Id (string)
    • Environment (string)
    • Organization (Organization)
    • Business channel (string)
    • Operation Id (string)
    • Operation Date (DateTime)
    • Reference Date (DateTime)
    • Accounting Date (DateTime)
    • Culture (string)
    • Properties (ContextDictionary)

Properties

Name

Description

AccountingDate

This is a DateTime property. A client application can populate this field with a date for accounting purposes. The default value is the current date and time.

BusinessChannel

This is a string property. It is used by the DCS infrastructure. It specifies the name of the business channel.

Correlations

This is a CorrelationsDictionary property. It stores correlation GUIDs that the DCS infrastructure uses to map request and response messages for conversational workflows and transparent processes.

Culture

This is a string property. A client application can populate this property with a value that identifies the culture of the user running the client application. By default, it is empty.

Current

This is a static property. It returns a reference to the current context object for a request.

Environment

This is a string property. A client application uses this property to specify the environment element of the scope for a request. For more information, see DCS Scopes.

LogonSessionId

This is a string property. The DCS infrastructure does not use this property, but a DCS service can define an operation filter that examines it.

OperationDate

This is a DateTime property. A client application can populate this field with a date of the current request that contains the context object. The default value is the current date and time.

OperationId

This is a string property. It is used by the DCS infrastructure to uniquely identify a call made by a client application to an operation.

Organization

This is an Organization object. A client application uses this property to specify the organizational elements of the scope for a request. For more information, see DCS Scopes.

Properties

This is a ContextDictionary property. It implements a property bag. A client application can add a custom property and value to this dictionary. This property provides a mechanism for adding a property to a context object without explicitly defining a custom property. This enables a service that uses the default custom class to accept requests from a client that uses a custom class without causing any type conflicts. The service effectively ignores the custom property.

ReferenceDate

This is a DateTime property. A client application can populate this field with a date for reference purposes. The default value is the current date and time.

SessionId

This is a string property. It is used by the DCS infrastructure to identify a session if the communication channel is session-based.

SSOTicket

This is a string property. It is currently not used by the DCS infrastructure.

User

This is a string property. A client application can populate this property with a value that identifies the user of the client application.

See Also

DCS Scopes