/// <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 StatefulServicePartitionInfo GetFromJsonProperties(JsonReader reader) { var healthState = default(HealthState?); var partitionStatus = default(ServicePartitionStatus?); var partitionInformation = default(PartitionInformation); var targetReplicaSetSize = default(long?); var minReplicaSetSize = default(long?); var lastQuorumLossDuration = default(TimeSpan?); var primaryEpoch = default(Epoch); do { var propName = reader.ReadPropertyName(); if (string.Compare("HealthState", propName, StringComparison.OrdinalIgnoreCase) == 0) { healthState = HealthStateConverter.Deserialize(reader); } else if (string.Compare("PartitionStatus", propName, StringComparison.OrdinalIgnoreCase) == 0) { partitionStatus = ServicePartitionStatusConverter.Deserialize(reader); } else if (string.Compare("PartitionInformation", propName, StringComparison.OrdinalIgnoreCase) == 0) { partitionInformation = PartitionInformationConverter.Deserialize(reader); } else if (string.Compare("TargetReplicaSetSize", propName, StringComparison.OrdinalIgnoreCase) == 0) { targetReplicaSetSize = reader.ReadValueAsLong(); } else if (string.Compare("MinReplicaSetSize", propName, StringComparison.OrdinalIgnoreCase) == 0) { minReplicaSetSize = reader.ReadValueAsLong(); } else if (string.Compare("LastQuorumLossDuration", propName, StringComparison.OrdinalIgnoreCase) == 0) { lastQuorumLossDuration = reader.ReadValueAsTimeSpan(); } else if (string.Compare("PrimaryEpoch", propName, StringComparison.OrdinalIgnoreCase) == 0) { primaryEpoch = EpochConverter.Deserialize(reader); } else { reader.SkipPropertyValue(); } }while (reader.TokenType != JsonToken.EndObject); return(new StatefulServicePartitionInfo( healthState: healthState, partitionStatus: partitionStatus, partitionInformation: partitionInformation, targetReplicaSetSize: targetReplicaSetSize, minReplicaSetSize: minReplicaSetSize, lastQuorumLossDuration: lastQuorumLossDuration, primaryEpoch: primaryEpoch)); }
/// <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 StatelessServicePartitionInfo GetFromJsonProperties(JsonReader reader) { var healthState = default(HealthState?); var partitionStatus = default(ServicePartitionStatus?); var partitionInformation = default(PartitionInformation); var instanceCount = default(long?); var minInstanceCount = default(int?); var minInstancePercentage = default(int?); do { var propName = reader.ReadPropertyName(); if (string.Compare("HealthState", propName, StringComparison.OrdinalIgnoreCase) == 0) { healthState = HealthStateConverter.Deserialize(reader); } else if (string.Compare("PartitionStatus", propName, StringComparison.OrdinalIgnoreCase) == 0) { partitionStatus = ServicePartitionStatusConverter.Deserialize(reader); } else if (string.Compare("PartitionInformation", propName, StringComparison.OrdinalIgnoreCase) == 0) { partitionInformation = PartitionInformationConverter.Deserialize(reader); } else if (string.Compare("InstanceCount", propName, StringComparison.OrdinalIgnoreCase) == 0) { instanceCount = reader.ReadValueAsLong(); } else if (string.Compare("MinInstanceCount", propName, StringComparison.OrdinalIgnoreCase) == 0) { minInstanceCount = reader.ReadValueAsInt(); } else if (string.Compare("MinInstancePercentage", propName, StringComparison.OrdinalIgnoreCase) == 0) { minInstancePercentage = reader.ReadValueAsInt(); } else { reader.SkipPropertyValue(); } }while (reader.TokenType != JsonToken.EndObject); return(new StatelessServicePartitionInfo( healthState: healthState, partitionStatus: partitionStatus, partitionInformation: partitionInformation, instanceCount: instanceCount, minInstanceCount: minInstanceCount, minInstancePercentage: minInstancePercentage)); }
/// <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 ResolvedServicePartition GetFromJsonProperties(JsonReader reader) { var name = default(ServiceName); var partitionInformation = default(PartitionInformation); var endpoints = default(IEnumerable <ResolvedServiceEndpoint>); var version = default(string); do { var propName = reader.ReadPropertyName(); if (string.Compare("Name", propName, StringComparison.Ordinal) == 0) { name = ServiceNameConverter.Deserialize(reader); } else if (string.Compare("PartitionInformation", propName, StringComparison.Ordinal) == 0) { partitionInformation = PartitionInformationConverter.Deserialize(reader); } else if (string.Compare("Endpoints", propName, StringComparison.Ordinal) == 0) { endpoints = reader.ReadList(ResolvedServiceEndpointConverter.Deserialize); } else if (string.Compare("Version", propName, StringComparison.Ordinal) == 0) { version = reader.ReadValueAsString(); } else { reader.SkipPropertyValue(); } }while (reader.TokenType != JsonToken.EndObject); return(new ResolvedServicePartition( name: name, partitionInformation: partitionInformation, endpoints: endpoints, version: version)); }
/// <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(Epoch); var lsnOfLastBackupRecord = default(string); var creationTimeUtc = default(DateTime?); var serviceManifestVersion = default(string); 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 = EpochConverter.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("ServiceManifestVersion", propName, StringComparison.Ordinal) == 0) { serviceManifestVersion = 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 BackupInfo( backupId: backupId, backupChainId: backupChainId, applicationName: applicationName, serviceName: serviceName, partitionInformation: partitionInformation, backupLocation: backupLocation, backupType: backupType, epochOfLastBackupRecord: epochOfLastBackupRecord, lsnOfLastBackupRecord: lsnOfLastBackupRecord, creationTimeUtc: creationTimeUtc, serviceManifestVersion: serviceManifestVersion, failureError: failureError)); }