Struct ServiceActivationOptions
- Namespace
- Microsoft.ServiceHub.Framework
- Assembly
- Microsoft.ServiceHub.Framework.dll
Activation options that may optionally be supplied to a service when activating it.
[DataContract]
public struct ServiceActivationOptions : IEquatable<ServiceActivationOptions>
- Implements
- Inherited Members
Remarks
This type must use only built-in types since every applicable IRemoteServiceBroker is required to be able to directly serialize it.
Properties
ActivationArguments
Gets or sets a map of arbitrary data, presumably meaningful to the service.
[DataMember]
public IReadOnlyDictionary<string, string>? ActivationArguments { readonly get; set; }
Property Value
- IReadOnlyDictionary<string, string>
May be null.
ClientCredentials
Gets or sets a map that describes the client's identity in terms that an identity or authorization service can interpret.
[DataMember]
public IReadOnlyDictionary<string, string>? ClientCredentials { readonly get; set; }
Property Value
ClientCulture
Gets or sets the client's preferred culture.
[JsonConverter(typeof(CultureInfoJsonConverter))]
[JsonConverter(typeof(CultureInfoSystemTextJsonConverter))]
[DataMember]
public CultureInfo? ClientCulture { readonly get; set; }
Property Value
ClientRpcTarget
Gets or sets an RPC target that the client offers to the requested service so the service can invoke members on the client.
[JsonIgnore]
[IgnoreDataMember]
[JsonIgnore]
public object? ClientRpcTarget { readonly get; set; }
Property Value
Remarks
This object is never serialized. If the service is available locally this object is made available directly to the service. If the service is remote, the remote service broker client such as RemoteServiceBroker should set this object as the local RPC target when setting up an RPC connection, and the service-side should set up a proxy for this object based on the type given in ClientInterface.
ClientUICulture
Gets or sets the client's preferred UI culture.
[JsonConverter(typeof(CultureInfoJsonConverter))]
[JsonConverter(typeof(CultureInfoSystemTextJsonConverter))]
[DataMember]
public CultureInfo? ClientUICulture { readonly get; set; }
Property Value
MultiplexingStream
Gets or sets the Nerdbank.Streams.MultiplexingStream associated with the connection between the client and the service broker. This may be used to establish additional channels between client and service.
[JsonIgnore]
[IgnoreDataMember]
[JsonIgnore]
public MultiplexingStream? MultiplexingStream { readonly get; set; }
Property Value
- MultiplexingStream
Remarks
This object is never serialized. If the service is available locally this object can be ignored by the broker and service because client and service can exchange streams directly. If the service is remote, the IRemoteServiceBroker such as MultiplexingRelayServiceBroker should set this property on the activation options before forwarding the request to the final service broker. The final service broker should then apply this value to the ServiceRpcDescriptor using WithMultiplexingStream(MultiplexingStream?).
Methods
ApplyCultureToCurrentContext()
Applies the values of ClientCulture and ClientUICulture to the current ExecutionContext, if they have been set on this struct.
public ServiceActivationOptions.CultureApplication ApplyCultureToCurrentContext()
Returns
- ServiceActivationOptions.CultureApplication
A value to dispose of to revert the CultureInfo properties to their prior values.
Remarks
By surrounding construction of a ServiceRpcDescriptor.RpcConnection with the client's applied culture, that connection is expected to pick it up and dispatch incoming RPC requests using that culture.
Equals(ServiceActivationOptions)
public bool Equals(ServiceActivationOptions other)
Parameters
otherServiceActivationOptions
Returns
SetClientDefaults()
Automatically set properties on this type where possible based on the client environment, if they have not already had values assigned.
public void SetClientDefaults()