Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ActorStateChange"/> class.
        /// </summary>
        /// <param name="stateName">The name of the actor state.</param>
        /// <param name="type">The type of value associated with given actor state name.</param>
        /// <param name="value">The value associated with given actor state name.</param>
        /// <param name="changeKind">The kind of state change for given actor state name.</param>
        public ActorStateChange(string stateName, Type type, object value, StateChangeKind changeKind)
        {
            ArgumentVerifier.ThrowIfNull(stateName, nameof(stateName));

            this.StateName  = stateName;
            this.Type       = type;
            this.Value      = value;
            this.ChangeKind = changeKind;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates an instance of ActorStateChange class.
        /// </summary>
        /// <param name="stateName">Name of the actor state</param>
        /// <param name="type">Type of value associated with given actor state name.</param>
        /// <param name="value">Value associated with given actor state name.</param>
        /// <param name="changeKind">Kind of state change for given actor state name.</param>
        public ActorStateChange(string stateName, Type type, object value, StateChangeKind changeKind)
        {
            Requires.Argument("stateName", stateName).NotNull();

            this.stateName  = stateName;
            this.type       = type;
            this.value      = value;
            this.changeKind = changeKind;
        }
Exemplo n.º 3
0
        private string GetDaprStateOperation(StateChangeKind changeKind)
        {
            var operation = string.Empty;

            switch (changeKind)
            {
                case StateChangeKind.Remove:
                    operation = "delete";
                    break;
                case StateChangeKind.Add:
                case StateChangeKind.Update:
                    operation = "upsert";
                    break;
                default:
                    break;
            }

            return operation;
        }
 public SerializedStateChange(StateChangeKind changeKind, string key, byte[] serializedState)
 {
     this.changeKind      = changeKind;
     this.key             = key;
     this.serializedState = serializedState;
 }
Exemplo n.º 5
0
 public static StateMetadata Create <T>(T value, StateChangeKind changeKind)
 {
     return(new StateMetadata(value, typeof(T), changeKind));
 }
Exemplo n.º 6
0
 private StateMetadata(object value, Type type, StateChangeKind changeKind)
 {
     this.Value      = value;
     this.Type       = type;
     this.ChangeKind = changeKind;
 }