简体   繁体   中英

Entity Framework 5 reload from database using a stored procedure

I have this line of code which loads some data from my database using a stored procedure.

List<myObj) myObjs = context.myStoredProc(myParameter).ToList();

I can't find the right syntax to force a reload from the database and replace the current data with data from the database.

I am trying:

context.Entry().Reload(); 

but this is wrong because I do not know what goes in the brackets.

I have other entities on this context which are tracked. The context is not disposed.

List<myObj) myObjs = context.myStoredProc(myParameter).ToList();

Does not overwrite the current values.

Unless the results of context.myStoredProc(myParameter).ToList(); is a list of tracked entities, you will need to call myObjs = context.myStoredProc(myParameter).ToList(); again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM