Click or drag to resize

TenantIdentificationContextExtension Class

Extension for OperationContext that allows propagation of the tenant ID.
Inheritance Hierarchy

Namespace:  Autofac.Multitenant.Wcf
Assembly:  Autofac.Multitenant.Wcf (in Autofac.Multitenant.Wcf.dll) Version: 4.0.0-CI-234
public class TenantIdentificationContextExtension : IExtension<OperationContext>

The TenantIdentificationContextExtension type exposes the following members.

Public methodTenantIdentificationContextExtension
Initializes a new instance of the TenantIdentificationContextExtension class
Public propertyTenantId
Gets or sets the tenant ID.
Public methodAttach
Enables an extension object to find out when it has been aggregated.
Public methodDetach
Enables an object to find out when it is no longer aggregated.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)

Use this extension in conjunction with the OperationContextTenantIdentificationStrategy to determine which tenant a given operation is running under.

For example, you could use an IDispatchMessageInspector that gets the tenant ID from an incoming header and adds a TenantIdentificationContextExtension to the current OperationContext with the tenant ID value. Then you could register the OperationContextTenantIdentificationStrategy as the mechanism for determining the tenant ID when resolving multitenant dependencies.

The TenantPropagationBehaviorTTenantId is a behavior that does exactly that - adds the tenant ID to outbound messages on the client and parses them on the service side. For a usage example, see TenantPropagationBehaviorTTenantId

See Also