score:2
Accepted answer
The call to the ToString
method is not supported inside linq queries. Try parsing the id to guid and do a simple equality like this:
return _client.CreateDocumentQuery<TEntity>(_selfLink).Where(u => u.Id == Guid.Parse(id)).AsEnumerable().FirstOrDefault();
Source: stackoverflow.com
Related Articles
- CreateDocumentQuery throws exception when used with LINQ, fine with SQL
- Is C# LINQ OrderBy threadsafe when used with ConcurrentDictionary<Tkey, TValue>?
- Concatenating three lists into one with LINQ throws an exception
- Getting an invalid cast exception when trying to order a list of objects with linq
- Linq to CRM (early bound) join statement throws exception when lambda expression doesn't
- Compilation error when i used lambda creator with base type for `Where` condition in linq
- LinQ to SQL throws Stackoverflow exception when using Any()
- C# LINQ - Does Select filter nulls when used with a method group?
- Exception raised when using a Linq query with Entity Framework
- Linq sub query when using a repository pattern with EF code first
- Sometimes get Timeout expired exception with Linq to EF and after a restart of server, it works fine
- Linq To SQL with left join and sum() throws exception
- Why does ToDictionary<K,V>() generate a compiler error when used with LINQ to SQL?
- Gridview Error Data Contains No Rows when Used with Linq
- JSON.NET Argument Exception when creating JSON with LINQ
- Max throws NullReferenceException when used with DefaultIfEmpty
- LINQ in ASP.NET -- throws exception when deployed to the server
- LINQ NotSupportedOperation exception with Code First
- Having an issue with a null exception on WPF DataGrid when trying to display data from a database with Linq
- Ternary operator in LINQ queries used for handle nullable DateTime throws the exception
- LINQ All not working as expected when used with Contains
- sql to LINQ with left join group by and sum() throws exception
- Is Linq Include broken when used with joins and where clauses?
- NullReference exception when using LINQ Contains with Entity Framework
- How to query an XDocument with LINQ when elements have a colon in their name?
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- Mocking Delegate.Invoke() using Moq throws InvalidCast exception in LINQ
- How to avoid memory overflow when querying large datasets with Entity Framework and LINQ
- Why does LINQ query throw an exception when I attempt to get a count of a type
- Duplicate Rows when Data Binding with LINQ to Entities
- How to get an Id (int) using Linq or Lambda based on condition in C#?
- Linq - Rows In Database not Deleting
- Will someone explain me this LINQ Query in Detail, which I have applied on SharePoint Project ? Why P object is used?
- If null then set it to empty string lambda expression in linq
- How to get a specific dictionary key value from ListDictionary?
- Linq query - reading nested XML to dictionary
- LINQ Generic Query with inherited base class?
- LINQ contains on Nullable guid field
- Linq, array.Contains() generating exception: Only primitive types ('such as Int32, String, and Guid') are supported in this context
- Filter data with more than date ranges in LINQ
- Using IEnumerable.Aggregate with asynchronous calls
- how do i get the min from a linq to dataset query
- Which one is better for performance: foreach()tatement or Where() query?
- LINQ Filter values on list values using contain
- How to check if the value exist in the database table ignoring null in LINQ C#
- Linq statement to conditionally include or exclude then count results
- The key value at position 0 of the call to 'DbSet<>.Find' was of type 'string', which does not match the property type of 'long?'
- C# How to convert SQL into a LINQ query
- Converting a list of objects to a list of an object property
- Remove Element from xDocument based on value in repeating segment