/// <summary>
        /// Gets the object from Json properties.
        /// </summary>
        /// <param name="reader">The <see cref="T: Newtonsoft.Json.JsonReader" /> to read from, reader must be placed at first property.</param>
        /// <returns>The object Value.</returns>
        internal static PartitionRestartProgress GetFromJsonProperties(JsonReader reader)
        {
            var state = default(OperationState?);
            var restartPartitionResult = default(RestartPartitionResult);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("State", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    state = OperationStateConverter.Deserialize(reader);
                }
                else if (string.Compare("RestartPartitionResult", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    restartPartitionResult = RestartPartitionResultConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new PartitionRestartProgress(
                       state: state,
                       restartPartitionResult: restartPartitionResult));
        }
Beispiel #2
0
        /// <summary>
        /// Gets the object from Json properties.
        /// </summary>
        /// <param name="reader">The <see cref="T: Newtonsoft.Json.JsonReader" /> to read from, reader must be placed at first property.</param>
        /// <returns>The object Value.</returns>
        internal static OperationStatus GetFromJsonProperties(JsonReader reader)
        {
            var operationId = default(Guid?);
            var state       = default(OperationState?);
            var type        = default(OperationType?);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("OperationId", propName, StringComparison.Ordinal) == 0)
                {
                    operationId = reader.ReadValueAsGuid();
                }
                else if (string.Compare("State", propName, StringComparison.Ordinal) == 0)
                {
                    state = OperationStateConverter.Deserialize(reader);
                }
                else if (string.Compare("Type", propName, StringComparison.Ordinal) == 0)
                {
                    type = OperationTypeConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new OperationStatus(
                       operationId: operationId,
                       state: state,
                       type: type));
        }