/// <summary>Tries to convert values to the keys of the specified type.</summary> /// <param name="targetEntityType">The specified type.</param> /// <param name="keyPairs">The converted key-value pairs.</param> /// <param name="resolver">The resolver to use.</param> /// <returns>true if all values were converted; false otherwise.</returns> public bool TryConvertValues(IEdmEntityType targetEntityType, out IEnumerable <KeyValuePair <string, object> > keyPairs, ODataUriResolver resolver) { Debug.Assert(!this.IsEmpty, "!this.IsEmpty -- caller should check"); if (this.NamedValues != null) { keyPairs = resolver.ResolveKeys(targetEntityType, this.NamedValues, this.ConvertValueWrapper); } else { Debug.Assert(this.positionalValues != null, "positionalValues != null -- otherwise this is Empty"); keyPairs = resolver.ResolveKeys(targetEntityType, this.PositionalValues, this.ConvertValueWrapper); } return(true); }
/// <summary>Tries to convert values to the keys of the specified type.</summary> /// <param name="targetEntityType">The specified type.</param> /// <param name="keyPairs">The converted key-value pairs.</param> /// <param name="resolver">The resolver to use.</param> /// <returns>true if all values were converted; false otherwise.</returns> public bool TryConvertValues(IEdmEntityType targetEntityType, out IEnumerable <KeyValuePair <string, object> > keyPairs, ODataUriResolver resolver) { Debug.Assert(!this.IsEmpty, "!this.IsEmpty -- caller should check"); Debug.Assert(targetEntityType.Key().Count() == this.ValueCount || resolver.GetType() != typeof(ODataUriResolver), "type.KeyProperties.Count == this.ValueCount -- will change with containment"); if (this.NamedValues != null) { keyPairs = resolver.ResolveKeys(targetEntityType, this.NamedValues, this.ConvertValueWrapper); } else { Debug.Assert(this.positionalValues != null, "positionalValues != null -- otherwise this is Empty"); Debug.Assert(this.PositionalValues.Count == targetEntityType.Key().Count() || resolver.GetType() != typeof(ODataUriResolver), "Count of positional values does not match."); keyPairs = resolver.ResolveKeys(targetEntityType, this.PositionalValues, this.ConvertValueWrapper); } return(true); }