Click here to Skip to main content
14,659,903 members
Home » Discussions » Visual Basic
   

Visual Basic

 
GeneralRe: Force entity framework to load new data from database without disposing the context Pin
desanti2-Apr-19 7:40
Memberdesanti2-Apr-19 7:40 
GeneralRe: Force entity framework to load new data from database without disposing the context Pin
Dave Kreskowiak2-Apr-19 9:11
mveDave Kreskowiak2-Apr-19 9:11 
GeneralRe: Force entity framework to load new data from database without disposing the context Pin
desanti2-Apr-19 9:22
Memberdesanti2-Apr-19 9:22 
GeneralRe: Force entity framework to load new data from database without disposing the context Pin
Dave Kreskowiak2-Apr-19 11:24
mveDave Kreskowiak2-Apr-19 11:24 
GeneralRe: Force entity framework to load new data from database without disposing the context Pin
desanti3-Apr-19 5:01
Memberdesanti3-Apr-19 5:01 
GeneralRe: Force entity framework to load new data from database without disposing the context Pin
Dave Kreskowiak3-Apr-19 7:22
mveDave Kreskowiak3-Apr-19 7:22 
GeneralRe: Force entity framework to load new data from database without disposing the context Pin
desanti3-Apr-19 8:23
Memberdesanti3-Apr-19 8:23 
GeneralRe: Force entity framework to load new data from database without disposing the context Pin
Dave Kreskowiak3-Apr-19 8:57
mveDave Kreskowiak3-Apr-19 8:57 
Quote:
Ok , and why EF does not keep the records that are in local cache , but instead "use the information" that those records are not show up in the result set of database ? And why in the case of modified records , "the information from database" is not used , and it's just keep the records from local cache.

That made no sense at all.

EF maintains a cache of objects reconstituted from result sets returned by the database. Once the result set is returned, there is no connection between the objects and the database. If the database changes, EF gets no notification at all that anything happened to the database copy.

If you have modified records, EF maintains the original "as loaded" copy of the object and the modifications to it. When EF goes to update the records in the tables, all of the original field values go into the WHERE clause of the SQL DELETE OR UPDATE statements. If any of those fields do not match the current data in the fields in the database table, the query fails to update the record because of a concurrency problem. You're not updating the latest version of the record. You're trying to update a newer version of the record than what you retrieved. That is a problem not solved by EF or the database.

Seriously, go Google "database concurrency" and start reading.

desanti wrote:
If the cached data is modified , i think EF should let the programmers to choose

And how do you propose you do that in the EF code? EF avoids the problem by not handling it at all, letting YOU decide how to handle it, which is why you even asked this question in the first place because of performance. Having EF do it internally will not make it any faster. It still has to same limitations you do handling it yourself, row-by-row from the cached data.

There is no solution to the performance problem! Again, your only chance at making either of the two solutions "faster" is to cache less data at the client.

GeneralRe: Force entity framework to load new data from database without disposing the context Pin
desanti3-Apr-19 9:40
Memberdesanti3-Apr-19 9:40 
GeneralRe: Force entity framework to load new data from database without disposing the context Pin
Dave Kreskowiak3-Apr-19 10:30
mveDave Kreskowiak3-Apr-19 10:30 
GeneralRe: Force entity framework to load new data from database without disposing the context Pin
desanti3-Apr-19 11:16
Memberdesanti3-Apr-19 11:16 
GeneralRe: Force entity framework to load new data from database without disposing the context Pin
desanti4-Apr-19 0:41
Memberdesanti4-Apr-19 0:41 
GeneralRe: Force entity framework to load new data from database without disposing the context Pin
Dave Kreskowiak4-Apr-19 5:49
mveDave Kreskowiak4-Apr-19 5:49 
GeneralRe: Force entity framework to load new data from database without disposing the context Pin
desanti4-Apr-19 6:18
Memberdesanti4-Apr-19 6:18 
GeneralRe: Force entity framework to load new data from database without disposing the context Pin
Dave Kreskowiak4-Apr-19 9:22
mveDave Kreskowiak4-Apr-19 9:22 
Questioni want to import a text file to datatable or something like that Pin
Member 142077921-Apr-19 4:41
MemberMember 142077921-Apr-19 4:41 
AnswerRe: i want to import a text file to datatable or something like that Pin
David Mujica1-Apr-19 5:37
MemberDavid Mujica1-Apr-19 5:37 
GeneralRe: i want to import a text file to datatable or something like that Pin
Member 142077921-Apr-19 21:10
MemberMember 142077921-Apr-19 21:10 
AnswerRe: i want to import a text file to datatable or something like that Pin
Richard MacCutchan1-Apr-19 5:55
mveRichard MacCutchan1-Apr-19 5:55 
GeneralRe: i want to import a text file to datatable or something like that Pin
Member 142077921-Apr-19 21:08
MemberMember 142077921-Apr-19 21:08 
GeneralRe: i want to import a text file to datatable or something like that Pin
Richard MacCutchan1-Apr-19 21:20
mveRichard MacCutchan1-Apr-19 21:20 
GeneralRe: i want to import a text file to datatable or something like that Pin
Member 142077921-Apr-19 21:23
MemberMember 142077921-Apr-19 21:23 
QuestionDataGridView Mouse Hover Event Pin
Give me a break I'm new31-Mar-19 5:54
MemberGive me a break I'm new31-Mar-19 5:54 
AnswerRe: DataGridView Mouse Hover Event Pin
mo149231-Mar-19 7:45
Membermo149231-Mar-19 7:45 
QuestionJust wondering it this code is safe. Thanks for input. MESSAGE CLOSED Pin
mo149227-Mar-19 2:22
Membermo149227-Mar-19 2:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.