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 Query
- CreateDocumentQuery throws exception when used with LINQ, fine with SQL
- LinQ to SQL throws Stackoverflow exception when using Any()
- Linq To SQL with left join and sum() throws exception
- sql to LINQ with left join group by and sum() throws exception
- Is C# LINQ OrderBy threadsafe when used with ConcurrentDictionary<Tkey, TValue>?
- Concatenating three lists into one with LINQ throws an exception
- LINQ to SQL - Compile error when extending data context with partial class and methods
- 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
- Foreign Key Reference Already Has Value Exception Linq to SQL When Assigning Null
- Reuse Linq to SQL code with entityframework
- 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
- Linq to sql as object data source - designer problem with partial classes
- Sometimes get Timeout expired exception with Linq to EF and after a restart of server, it works fine
- linq to sql + stackoverflow exception when querying objects
- Accessing SQL Server time in code with LINQ
- Why does ToDictionary<K,V>() generate a compiler error when used with LINQ to SQL?
- SQL to LINQ with Case .. When in Order By
- Unable to determine SQL type for... when creating tables with LinQ
- 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
- Exception when changing data source to SQL
- LINQ in ASP.NET -- throws exception when deployed to the server
- LINQ to SQL throws SQL Exception using local collection
- My Linq to Sql Insert code seems to work fine but I don't get a record in the database
- Ineffective generation of SQL queries when using expressions with LINQ
More Query from same tag
- Writing a sub query in LINQ with Top X
- Filter all the Dictionary elements which are matching with the input string array only or any number
- Linq aggregate on accumulated bool values
- how to reference linq in user control?
- Is there a way to loop inside Where clause?
- Linq select in query in c#
- Changing DBML, how to change SQL database?
- Union with EF Core returns unable to translate set operation since both operands have different 'Include' operations
- How do you make a cast in Lambda expressions?
- Create String Array from database
- How do I declare this type as a return value?
- Filtering a deep json hierarchy with Linq
- LINQ for groupby and then finding the value based on least date
- Generic way of creating XML files in C#
- Is there a better way to achieve this with Linq or a better code
- Can't use Distinct function with an NTEXT field in C# and LINQ
- Populate a tree from Hierarchical data using 1 LINQ statement
- Remove lines from List<String[]> using Linq, if meeting a certain criteria
- How can I convert this linq expression to method form?
- How to run a function on all members of a list using linq?
- Generic Tree Structure - How to populate an org chart
- How retrieve deeper siblings using LINQ to XML?
- Group 2 similar requests Entity Framework / Linq in 1
- Linq Expression Selector
- Merging two Query Results
- Algorithm for comparing chars in strings
- Where is the implicit cast from TDelegate to Expression<TDelegate> declared?
- Linq grouping and nested grouping
- C# Linq Union Returning Null
- Trouble converting a Query Syntax LINQ query using a 'not in (subquery)' into Method Syntax