/// <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 BackupProgressInfo GetFromJsonProperties(JsonReader reader)
        {
            var backupState             = default(BackupState?);
            var timeStampUtc            = default(DateTime?);
            var backupId                = default(Guid?);
            var backupLocation          = default(string);
            var epochOfLastBackupRecord = default(BackupEpoch);
            var lsnOfLastBackupRecord   = default(string);
            var failureError            = default(FabricErrorError);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("BackupState", propName, StringComparison.Ordinal) == 0)
                {
                    backupState = BackupStateConverter.Deserialize(reader);
                }
                else if (string.Compare("TimeStampUtc", propName, StringComparison.Ordinal) == 0)
                {
                    timeStampUtc = reader.ReadValueAsDateTime();
                }
                else if (string.Compare("BackupId", propName, StringComparison.Ordinal) == 0)
                {
                    backupId = reader.ReadValueAsGuid();
                }
                else if (string.Compare("BackupLocation", propName, StringComparison.Ordinal) == 0)
                {
                    backupLocation = reader.ReadValueAsString();
                }
                else if (string.Compare("EpochOfLastBackupRecord", propName, StringComparison.Ordinal) == 0)
                {
                    epochOfLastBackupRecord = BackupEpochConverter.Deserialize(reader);
                }
                else if (string.Compare("LsnOfLastBackupRecord", propName, StringComparison.Ordinal) == 0)
                {
                    lsnOfLastBackupRecord = reader.ReadValueAsString();
                }
                else if (string.Compare("FailureError", propName, StringComparison.Ordinal) == 0)
                {
                    failureError = FabricErrorErrorConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new BackupProgressInfo(
                       backupState: backupState,
                       timeStampUtc: timeStampUtc,
                       backupId: backupId,
                       backupLocation: backupLocation,
                       epochOfLastBackupRecord: epochOfLastBackupRecord,
                       lsnOfLastBackupRecord: lsnOfLastBackupRecord,
                       failureError: failureError));
        }
        /// <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 RestoreProgressInfo GetFromJsonProperties(JsonReader reader)
        {
            var restoreState  = default(RestoreState?);
            var timeStampUtc  = default(DateTime?);
            var restoredEpoch = default(BackupEpoch);
            var restoredLsn   = default(string);
            var failureError  = default(FabricErrorError);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("RestoreState", propName, StringComparison.Ordinal) == 0)
                {
                    restoreState = RestoreStateConverter.Deserialize(reader);
                }
                else if (string.Compare("TimeStampUtc", propName, StringComparison.Ordinal) == 0)
                {
                    timeStampUtc = reader.ReadValueAsDateTime();
                }
                else if (string.Compare("RestoredEpoch", propName, StringComparison.Ordinal) == 0)
                {
                    restoredEpoch = BackupEpochConverter.Deserialize(reader);
                }
                else if (string.Compare("RestoredLsn", propName, StringComparison.Ordinal) == 0)
                {
                    restoredLsn = reader.ReadValueAsString();
                }
                else if (string.Compare("FailureError", propName, StringComparison.Ordinal) == 0)
                {
                    failureError = FabricErrorErrorConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new RestoreProgressInfo(
                       restoreState: restoreState,
                       timeStampUtc: timeStampUtc,
                       restoredEpoch: restoredEpoch,
                       restoredLsn: restoredLsn,
                       failureError: failureError));
        }
示例#3
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 BackupInfo GetFromJsonProperties(JsonReader reader)
        {
            var backupId                = default(Guid?);
            var backupChainId           = default(Guid?);
            var applicationName         = default(string);
            var serviceName             = default(string);
            var partitionInformation    = default(PartitionInformation);
            var backupLocation          = default(string);
            var backupType              = default(BackupType?);
            var epochOfLastBackupRecord = default(BackupEpoch);
            var lsnOfLastBackupRecord   = default(string);
            var creationTimeUtc         = default(DateTime?);
            var failureError            = default(FabricErrorError);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("BackupId", propName, StringComparison.Ordinal) == 0)
                {
                    backupId = reader.ReadValueAsGuid();
                }
                else if (string.Compare("BackupChainId", propName, StringComparison.Ordinal) == 0)
                {
                    backupChainId = reader.ReadValueAsGuid();
                }
                else if (string.Compare("ApplicationName", propName, StringComparison.Ordinal) == 0)
                {
                    applicationName = reader.ReadValueAsString();
                }
                else if (string.Compare("ServiceName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceName = reader.ReadValueAsString();
                }
                else if (string.Compare("PartitionInformation", propName, StringComparison.Ordinal) == 0)
                {
                    partitionInformation = PartitionInformationConverter.Deserialize(reader);
                }
                else if (string.Compare("BackupLocation", propName, StringComparison.Ordinal) == 0)
                {
                    backupLocation = reader.ReadValueAsString();
                }
                else if (string.Compare("BackupType", propName, StringComparison.Ordinal) == 0)
                {
                    backupType = BackupTypeConverter.Deserialize(reader);
                }
                else if (string.Compare("EpochOfLastBackupRecord", propName, StringComparison.Ordinal) == 0)
                {
                    epochOfLastBackupRecord = BackupEpochConverter.Deserialize(reader);
                }
                else if (string.Compare("LsnOfLastBackupRecord", propName, StringComparison.Ordinal) == 0)
                {
                    lsnOfLastBackupRecord = reader.ReadValueAsString();
                }
                else if (string.Compare("CreationTimeUtc", propName, StringComparison.Ordinal) == 0)
                {
                    creationTimeUtc = reader.ReadValueAsDateTime();
                }
                else if (string.Compare("FailureError", propName, StringComparison.Ordinal) == 0)
                {
                    failureError = FabricErrorErrorConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new BackupInfo(
                       backupId: backupId,
                       backupChainId: backupChainId,
                       applicationName: applicationName,
                       serviceName: serviceName,
                       partitionInformation: partitionInformation,
                       backupLocation: backupLocation,
                       backupType: backupType,
                       epochOfLastBackupRecord: epochOfLastBackupRecord,
                       lsnOfLastBackupRecord: lsnOfLastBackupRecord,
                       creationTimeUtc: creationTimeUtc,
                       failureError: failureError));
        }