I had an issue with Foreign Keys which were based on GUID types.
The code below would not match the GUID type keys.
I fixed the problem by adding a test for GUID .
Not sure if that is a good thing or not but it solved my problem
Please check if this should be fix in the code base
Thanks
private static string GetQueryEntitySql(string entitySetName,
string foreignKeyName, params object[] keyValues)
{
if (keyValues.Length == 0) return null;
var ids = from k in keyValues
// select k is string ? string.Format("'{0}'", k) : k.ToString(); -- replaced with statement below
select k is string ? string.Format("'{0}'", k) : k is Guid ? string.Format("Guid '{0}'", k) : k.ToString();
string csvIds = string.Join(",", ids);
string entitySql = string.Format
("SELECT VALUE x FROM {0} AS x WHERE x.{1} IN {{{2}}}",
entitySetName, foreignKeyName, csvIds);
return entitySql;
}
I had an issue with Foreign Keys which were based on GUID types.
The code below would not match the GUID type keys. I fixed the problem by adding a test for GUID . Not sure if that is a good thing or not but it solved my problem Please check if this should be fix in the code base Thanks
private static string GetQueryEntitySql(string entitySetName, string foreignKeyName, params object[] keyValues) { if (keyValues.Length == 0) return null; var ids = from k in keyValues // select k is string ? string.Format("'{0}'", k) : k.ToString(); -- replaced with statement below select k is string ? string.Format("'{0}'", k) : k is Guid ? string.Format("Guid '{0}'", k) : k.ToString();
string csvIds = string.Join(",", ids); string entitySql = string.Format ("SELECT VALUE x FROM {0} AS x WHERE x.{1} IN {{{2}}}", entitySetName, foreignKeyName, csvIds); return entitySql; }