/// <summary> /// Gets the object from Json properties. /// </summary> /// <param name="reader">The <see cref="T: Newtonsoft.Json.JsonReader" /> to read from.</param> /// <returns>The object Value.</returns> internal static ServiceDescription GetFromJsonProperties(JsonReader reader) { ServiceDescription obj; var propName = reader.ReadPropertyName(); if (!propName.Equals("ServiceKind", StringComparison.Ordinal)) { throw new JsonReaderException($"Incorrect discriminator property name {propName}, Expected discriminator property name is ServiceKind."); } var propValue = reader.ReadValueAsString(); if (propValue.Equals("Stateful", StringComparison.Ordinal)) { obj = StatefulServiceDescriptionConverter.GetFromJsonProperties(reader); } else if (propValue.Equals("Stateless", StringComparison.Ordinal)) { obj = StatelessServiceDescriptionConverter.GetFromJsonProperties(reader); } else { throw new InvalidOperationException("Unknown ServiceKind."); } return(obj); }