Skip to content

Commit

Permalink
Make DataServiceQuerySingle.GetValueAsync consistent with GetValue
Browse files Browse the repository at this point in the history
Use SingleOrDefault() instead of Single() to get the same behavior as GetValue.

Fixes OData#698
  • Loading branch information
0xced committed Sep 8, 2017
1 parent 51136ea commit a56b093
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Microsoft.OData.Client/DataServiceQuerySingleOfT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ public TElement EndGetValue(IAsyncResult asyncResult)
Util.CheckArgumentNull(asyncResult, "asyncResult");
if (this.isFunction)
{
return this.Context.EndExecute<TElement>(asyncResult).Single();
return this.Context.EndExecute<TElement>(asyncResult).SingleOrDefault();
}
else
{
return this.Query.EndExecute(asyncResult).Single();
return this.Query.EndExecute(asyncResult).SingleOrDefault();
}
}

Expand Down

0 comments on commit a56b093

Please sign in to comment.