Question

I am working with Code First EntityFramework (version="6.1.0") and EntityFramework.Extended (version="6.1.0.96, the latest build at the moment from here.
The DbContext exposes the DbSets which are accessed like:

var set = ctx.Set<MyEntity>();

Today I decided to try Future Queries of the EntityFramework.Extended library, and ended pretty much soon, without an idea of how to proceed.

Here is the sample code:

using (var ctx = new MyDbContext())
{              
    var u = ctx.Set<User>().Future();
    var c = ctx.Set<Country>().Future();
    var users = u.ToList();
}

Regarding the Future() documentation I should get only one query to the DB which is what the Future() method provides. The query should be launched at u.ToList(); but what happens is that I get an error like this:

JIT Compiler encountered an internal limitation.

A stack trace dive tells me this:

at EntityFramework.Future.FutureQueryBase 1.GetResult()

at EntityFramework.Future.FutureQuery 1.GetEnumerator()

at System.Collections.Generic.List 1..ctor(IEnumerable 1 collection)

at System.Linq.Enumerable.ToList[TSource](IEnumerable 1 source)

at App.Program.Main(String[] args) in c:\Users\...\App\Program.cs:line 25

I really don't know what I'm missing out. I've checked that my ConnectionString has MultipleResultSets set to TRUE.
I've tested this with earlier build releases of EF.Exteneded but the same error occured.

Any idea would greatly help.

Was it helpful?

Solution 2

So to add up after one year later; updated the Entity Framework to the latest version 6.1.3, installed the latest EntityFramework.Extended library, and one thing to note is I've used the 'Database first' approach for the test and all went OK. Could've been other strange stuff out of my control then.

Thanks everyone for the support on this one.

OTHER TIPS

Could be wrong, but I think

ctx.Set<User>() 

returns a DBSet whereas .Future() is supposed to be used at the end of queries. Maybe if you append .AsQueryable to the end of ctx.Set()?

ctx.Set<User>().AsQueryable().Future()

Also I think you can just use ctx.users if you have your EF database built that way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top