Note that there are some explanatory texts on larger screens.

plurals
  1. POLinq2Sql - Storing Linq Expressions in cleartext (linq) for future dynamic execution
    primarykey
    data
    text
    <p>I recently posted this: </p> <p><A href="https://stackoverflow.com/questions/1558269/linq2sql-storing-complex-linq-queries-for-future-dynamic-execuction-raw-text"><a href="https://stackoverflow.com/questions/1558269/linq2sql-storing-complex-linq-queries-for-future-dynamic-execuction-raw-text">Linq2Sql - Storing Complex Linq Queries for future dynamic execuction - raw text - possible?</a></a></p> <p>It answered one question, but sent me down a different path because of the subQuery needing to reference the same table the original query already exists in.</p> <p>I was able to do exactly what I wanted to do in Linqpad using the "let" keyword.</p> <p>from posMain in DataEventView let posSub = from posSub1 in DataEventView where posSub1.CheckNumber == posMain.CheckNumber &amp;&amp; posSub1.EventTypeID == 7 select posSub1 where posMain.EventTypeID == 6 &amp;&amp; posSub.Any() select posMain</p> <p>That is effectively creating the sub-query I have been attempting to do.</p> <p>Now, I was thinking --- I would really like to dynamically create the IQueryable object in memory, and then my application can have reference to it, and continue to add expressions to it as needed.</p> <p>I am thinking I am going to have to do this with the CodeDom, but there may be a more elegant way of getting the IQueryable from just having Raw Text to start with. Has anyone had to store a linq statement for future execution? These statements are dynamic per customer, so they cant just be complied into the framework. Maybe there is a better idea?</p> <p>Thanks in advance.</p> <p>Travis</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload