sdk/dotnet/src/Microsoft.Datasync.Client/Serialization/ServiceSerializer.cs
/// <summary>
/// Gets the value of the ID property from a <see cref="JObject"/> instance, ensuring
/// that the value is valid.
/// </summary>
/// <param name="instance">The subject instance.</param>
/// <param name="ignoreCase">If <c>true</c>, find any variant spelling of the ID property.</param>
/// <param name="allowDefault">If <c>true</c>, the default value for the ID is valid.</param>
/// <returns>The ID property value.</returns>
/// <exception cref="ArgumentException">If the value is invalid.</exception>
Gets the value of the ID property from a  instance, ensuring
that the value is valid.
Gets the value of the ID property from a instance ensuring that the value is valid .
public static string GetId(JObject instance, bool ignoreCase = false, bool allowDefault = false)
        {
            Arguments.IsNotNull(instance, nameof(instance));
            bool hasId = TryGetId(instance, ignoreCase, out string id);
            if (!hasId && !ignoreCase && TryGetId(instance, true, out id))
            {
                throw new ArgumentException($"The casing of the '{SystemProperties.JsonIdProperty}' property is invalid.", nameof(instance));
            }
            if (hasId)
            {
                Arguments.IsValidId(id, nameof(instance));
            }
            else if (!allowDefault)
            {
                throw new ArgumentException($"Required '{SystemProperties.JsonIdProperty}' property is not found.", nameof(instance));
            }
            return id;
        }
public static string GetId ( JObject instance , bool ignoreCase = false , bool allowDefault = false ) { Arguments . IsNotNull ( instance , nameof ( instance ) ) ; bool hasId = TryGetId ( instance , ignoreCase , out string id ) ; if ( ! hasId && ! ignoreCase && TryGetId ( instance , true , out id ) ) { throw new ArgumentException ( $" The casing of the ' { SystemProperties . JsonIdProperty } ' property is invalid. " , nameof ( instance ) ) ; } if ( hasId ) { Arguments . IsValidId ( id , nameof ( instance ) ) ; } else if ( ! allowDefault ) { throw new ArgumentException ( $" Required ' { SystemProperties . JsonIdProperty } ' property is not found. " , nameof ( instance ) ) ; } return id ; }
Gets the value of the ID property from a  instance, ensuring
that the value is valid.
Gets the value of the ID property from a instance ensuring that the value is valid .
The ID property value.
The ID property value .
If the value is invalid.
If the value is invalid .
instance
JObject
The subject instance.
The subject instance .
ignoreCase
bool
None
allowDefault
bool
None