sdk/dotnet/src/Microsoft.Datasync.Client/Serialization/ServiceSerializer.cs
/// <summary>
/// Sets the instance's ID property value to the default ID value.
/// </summary>
/// <param name="instance">The instance on which to clear the ID property.</param>
Sets the instance's ID property value to the default ID value.
Sets the instance ' s ID property value to the default ID value .
public void SetIdToDefault(object instance)
        {
            Arguments.IsNotNull(instance, nameof(instance));
            if (instance is JObject json)
            {
                json[SystemProperties.JsonIdProperty] = null;
            }
            else
            {
                JsonProperty idProperty = SerializerSettings.ContractResolver.ResolveIdProperty(instance.GetType());
                idProperty.ValueProvider.SetValue(instance, null);
            }
        }
public void SetIdToDefault ( object instance ) { Arguments . IsNotNull ( instance , nameof ( instance ) ) ; if ( instance is JObject json ) { json [ SystemProperties . JsonIdProperty ] = null ; } else { JsonProperty idProperty = SerializerSettings . ContractResolver . ResolveIdProperty ( instance . GetType ( ) ) ; idProperty . ValueProvider . SetValue ( instance , null ) ; } }
Sets the instance's ID property value to the default ID value.
Sets the instance ' s ID property value to the default ID value .
instance
object
The instance on which to clear the ID property.
The instance on which to clear the ID property .