0

I honestly did not think that this would be difficult to accomplish but I'm trying to figure out how to take an entity linq query and insert it into a compiled query command but for the life of me, I cannot figure it out. I've search high and low and there's a ton of stuff talking about .net Core, but I'm not using .net Core.

Here's an example of my code that simply will not work.

var compiledQuery = CompiledQuery.Compile<dbEntities, DateTime, IQueryable<Transactions>> (((db,dateStamp) =>
            db.Transactions.Where(x =>
                x.Ledger == 6 && x.SubId != null && x.Dated < DbFunctions.AddDays(dateStamp, 1)));
Frank Thomas
  • 350
  • 5
  • 12
  • Can you be more specific about what's wrong? Are you getting a compiler error, runtime error, or simply unexpected results? You say you're not using Core--what .NET version are you using? I found some [documentation](https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/ef/language-reference/compiled-queries-linq-to-entities) that targets .NET Framework (not Core)--maybe there's something helpful in there. – xander Mar 07 '19 at 23:55
  • Also, I'm assuming you are using Entity Framework (and not some other LINQ based mechanism, like, for example, Linq2SQL). You may want to mention that and/or tag your question – Flydog57 Mar 07 '19 at 23:57
  • @Frank you'd better add few more lines of code to show what you want to do with `compiledQuery` – Lei Yang Mar 08 '19 at 00:22

0 Answers0