Esempio n. 1
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 StatefulServiceReplicaInfo GetFromJsonProperties(JsonReader reader)
        {
            var replicaStatus = default(ReplicaStatus?);
            var healthState   = default(HealthState?);
            var nodeName      = default(NodeName);
            var address       = default(string);
            var lastInBuildDurationInSeconds = default(string);
            var replicaRole = default(ReplicaRole?);
            var replicaId   = default(ReplicaId);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("ReplicaStatus", propName, StringComparison.Ordinal) == 0)
                {
                    replicaStatus = ReplicaStatusConverter.Deserialize(reader);
                }
                else if (string.Compare("HealthState", propName, StringComparison.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("NodeName", propName, StringComparison.Ordinal) == 0)
                {
                    nodeName = NodeNameConverter.Deserialize(reader);
                }
                else if (string.Compare("Address", propName, StringComparison.Ordinal) == 0)
                {
                    address = reader.ReadValueAsString();
                }
                else if (string.Compare("LastInBuildDurationInSeconds", propName, StringComparison.Ordinal) == 0)
                {
                    lastInBuildDurationInSeconds = reader.ReadValueAsString();
                }
                else if (string.Compare("ReplicaRole", propName, StringComparison.Ordinal) == 0)
                {
                    replicaRole = ReplicaRoleConverter.Deserialize(reader);
                }
                else if (string.Compare("ReplicaId", propName, StringComparison.Ordinal) == 0)
                {
                    replicaId = ReplicaIdConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new StatefulServiceReplicaInfo(
                       replicaStatus: replicaStatus,
                       healthState: healthState,
                       nodeName: nodeName,
                       address: address,
                       lastInBuildDurationInSeconds: lastInBuildDurationInSeconds,
                       replicaRole: replicaRole,
                       replicaId: replicaId));
        }
Esempio n. 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 DeployedStatefulServiceReplicaInfo GetFromJsonProperties(JsonReader reader)
        {
            var serviceName                = default(ServiceName);
            var serviceTypeName            = default(string);
            var serviceManifestName        = default(string);
            var codePackageName            = default(string);
            var partitionId                = default(PartitionId);
            var replicaStatus              = default(ReplicaStatus?);
            var address                    = default(string);
            var servicePackageActivationId = default(string);
            var hostProcessId              = default(string);
            var replicaId                  = default(ReplicaId);
            var replicaRole                = default(ReplicaRole?);
            var reconfigurationInformation = default(ReconfigurationInformation);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("ServiceName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceName = ServiceNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceTypeName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceTypeName = reader.ReadValueAsString();
                }
                else if (string.Compare("ServiceManifestName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceManifestName = reader.ReadValueAsString();
                }
                else if (string.Compare("CodePackageName", propName, StringComparison.Ordinal) == 0)
                {
                    codePackageName = reader.ReadValueAsString();
                }
                else if (string.Compare("PartitionId", propName, StringComparison.Ordinal) == 0)
                {
                    partitionId = PartitionIdConverter.Deserialize(reader);
                }
                else if (string.Compare("ReplicaStatus", propName, StringComparison.Ordinal) == 0)
                {
                    replicaStatus = ReplicaStatusConverter.Deserialize(reader);
                }
                else if (string.Compare("Address", propName, StringComparison.Ordinal) == 0)
                {
                    address = reader.ReadValueAsString();
                }
                else if (string.Compare("ServicePackageActivationId", propName, StringComparison.Ordinal) == 0)
                {
                    servicePackageActivationId = reader.ReadValueAsString();
                }
                else if (string.Compare("HostProcessId", propName, StringComparison.Ordinal) == 0)
                {
                    hostProcessId = reader.ReadValueAsString();
                }
                else if (string.Compare("ReplicaId", propName, StringComparison.Ordinal) == 0)
                {
                    replicaId = ReplicaIdConverter.Deserialize(reader);
                }
                else if (string.Compare("ReplicaRole", propName, StringComparison.Ordinal) == 0)
                {
                    replicaRole = ReplicaRoleConverter.Deserialize(reader);
                }
                else if (string.Compare("ReconfigurationInformation", propName, StringComparison.Ordinal) == 0)
                {
                    reconfigurationInformation = ReconfigurationInformationConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new DeployedStatefulServiceReplicaInfo(
                       serviceName: serviceName,
                       serviceTypeName: serviceTypeName,
                       serviceManifestName: serviceManifestName,
                       codePackageName: codePackageName,
                       partitionId: partitionId,
                       replicaStatus: replicaStatus,
                       address: address,
                       servicePackageActivationId: servicePackageActivationId,
                       hostProcessId: hostProcessId,
                       replicaId: replicaId,
                       replicaRole: replicaRole,
                       reconfigurationInformation: reconfigurationInformation));
        }