score:2
doing something like that is not simple. have a look at the series of articles building an iqueryable provider by matt warren. all the code he uses is available as a library too. that should help you get started.
score:0
check out the method datacontext.getcommand() which is passed an iqueryable object and returns the dbcommand object that corresponds to the query. the commandtext property of the dbcommand object shows the text of the query.
score:1
you could write an expression tree parser and generate the sql. your description contains a fault - myquery
isn't iqueryable<cat>
, it is an ienumerable<cat>
. as you tagged it correctly, this is linq-to-objects, not linq-to-sql. there is no information in the calls to construct a query.
Source: stackoverflow.com
Related Query
- convert linq to object query to sql query (no linq to sql code or datacontext)
- Determine the source DataContext for a Linq to Sql query
- Convert SQL update query to c# LINQ code
- Convert SQL to LINQ Query
- How can I convert this SQL Query into LINQ (OVER (PARTITION BY Date))
- LINQ SQL query check if a object field is not null
- Convert SQL query to LINQ
- Linq to entities - SQL Query - Where list contains object with 2 properties (or more)
- Convert SQL Query (with Correlated Subquery) to LINQ in C#
- Unable to convert SQL Query to LINQ Query for Left Outer Join
- Convert SQL into Linq query
- Convert Linq Data query to object type
- How to get SQL query into LINQ form in C# code
- Convert SQL Sub Query to In to Linq Lambda
- convert SQL to LINQ or imporve my query please
- How do I convert this SQL query to LINQ to SQL
- How to convert this SQL query to LINQ or Lambda expression?
- Linq to SQL intellisense has no knowledge of tables within the datacontext object
- Convert sql query with multiple inner joins to LINQ
- Does LINQ convert code to SQL queries
- How do i convert this linq code to inline sql
- Convert nested SQL query to LINQ Query
- Tools to convert sql query to linq
- Identify source of linq to sql query
- Linq to sql as object data source - designer problem with partial classes
- How to convert this complex SQL Query with Subqueries into LINQ
- Convert this LINQ code back to a Loop (or Why is this object sometimes null)
- Convert this SQL Query to LINQ Query
- Convert SQL Query back to Linq Expression programmatically
- how to convert from sql query to linq
More Query from same tag
- 'Specified cast is not valid' in LAMBDA expression when querying float field
- Unable to correctly transform data into hierarchy
- Fastest way to get values from 2d array
- How can I use a LINQ projection with List<MyStructure> to get a NameValueCollection?
- LINQ: How to convert from ISingleResult<T> to IQueryable<int>
- How to detect no data returned in C# LINQ query
- In C# how do access my LINQ var array from another method?
- Using String.compare inside a lambda expression
- Creating A Filetree from a directory with Json.net LINQ
- Building up an object in linq - adding properties that depend on other properties
- DataContext Translate<> for anonymous types
- How to Use Where with Many to Many Comparison
- Do while loop not looping when condition is true
- when does LINQ outperforms ado.net
- Anonymous Methods / Lambda's (Coding Standards)
- Dynamic Order (SQL ORDERBY) in LINQ CompiledQuery
- Group by single element, putting in a list some row
- Xamarin Studio's intellisense behaves badly for LINQ queries
- Select rounded time value
- Creating objects from xml error {"Value cannot be null.\r\nParameter name: element"}
- Group a C# collection by inequality with a maximum group size using LINQ
- How might I clean up this lambda?
- Linq Querying XML with nonstandard namespaces
- Get index of parameter of element in list
- Count rows in a text file that meet a condition
- Sort and filter IQueryable in datagridview
- More complex queries in LINQ than SQL
- Linq queries on dB and using custom Comparers
- Replacing a regular method with an anonymous method in C#/LINQ
- Why is a my List.Intersect returning different results than a Where(List.Contains)?