/// <summary> /// Creates a new instance of MetricReliableStateManager. /// </summary> /// <param name="context"></param> /// <param name="serializerResolver"></param> /// <param name="configProvider"></param> /// <param name="stateManager"> /// Best to leave this null and let the constructor create one that's configured with a fast binary serializer. /// Beware: if you pass in your own instance of ReliableStateManager, it will use DataContract. /// </param> public MetricReliableStateManager( StatefulServiceContext context, IReliableStateSerializerResolver serializerResolver, MetricConfiguration config = null, IReliableStateManagerReplica stateManager = null) { this.serializerResolver = serializerResolver; this.config = config ?? new MetricConfigurationSettingsXml(context); this.stateManagerReplica = stateManager ?? new ReliableStateManager( context, new ReliableStateManagerConfiguration( onInitializeStateSerializersEvent: () => { this.stateManagerReplica.StateManagerChanged += this.StateManagerReplica_StateManagerChanged; this.stateManagerReplica.TransactionChanged += this.StateManagerReplica_TransactionChanged; return(Task.FromResult(this.stateManagerReplica.TryAddStateSerializer <BinaryValue>(new BinaryValueStateSerializer()))); })); }
public BinaryValueConverter(Uri collectionName, IReliableStateSerializerResolver resolver) { this.serializerResolver = resolver; this.collectionName = collectionName; }