Using v1.8 .Net SDK
Trying return Sales where the Sale client array contains the Client ID I’m looking for.
Sales.Where(sale => sale.Clients.Any(c => c.ClientId == clientID));
Returns Error "Nullable object must have a value."
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task
1.get_Result()
at Microsoft.Azure.Documents.Linq.DocumentQuery1.GetEnumerator()
at System.Collections.Generic.List
1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)
ClientID is a GUID, but trying to query any property on the client object returns the same error.
If I run the same query on the same data but just using a List collection (i.e. not using DocumentDB) then all is fine.
Any advice appreciated. Thanks
This query can be alternatively expessed using SelectMany + Where:
Sales.SelectMany(s => s.Clients.Where(c => c.ClientID == clientID).Select(c => s));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With