Possible Duplicate:
DbContext's internal caching (?)
I have an instance of my DbContext
and a IQueryable
in the ViewModelBase
which fills from BootStrapper
and the IQueryable
needs to reload from the database several times, and I want to do it by calling some simple method without caring about what the query expression is.
In simple words :
I'd like to load the data into an IQueryable<T>
without rewriting the expression and tools I have are:
1 => An IQueryable
2 => An instance of DbContext
As I change data in the database and try IQueryable.ToList() , the result does not update.
IQueryable<Person> ViewModelDataContext;
ViewModelDataContext = repository.GetAll<Person>();
var x = ViewModelDataContext.ToList();
//Some changes into database
repository = new Repository();
var y = ViewModelDataContext.ToList();
//But as result, the x is exactly returns the same result as y and I'd like the y to be updated after database changes.
Any suggestions?