0

When I refresh the entity framework with big table, I get the System.OutOfMemoryException.

Is there any better way to refresh the EF with big tables? I'm using .Net 3.5

2 Answers 2

1

Like Darin says the refreshing of the model does not load any of the rows.

Since you are refreshing the model in code, I suspect that there may be something in your code that is loading all the rows, or has an infinate loop.

You can edit the EF model directly by opening the file and editing the xml. But you need to be very carefull if you do this.

Sign up to request clarification or add additional context in comments.

3 Comments

I hope I'll explian properly. I've some code that do DB updates. There are 2 parts to it. 1. the EF call the Stored Procedure to update DB. (this is big existing logic. so I can't rewrite in linq) 2. the EF + linq also does some DB operation in the same method. At some point, it uses the DB changes done by SP. The problem is that, EF can't recognise the changes done by SP. When EF fetches the data, it still has the old values. How do I refresh the EF?
You only need to refresh the model if you make a change to the structure of the tables.
Are you trying to insert rows or change the structure of your tables?
0

I don't know what do you mean by refreshing the EF with big tables but the only way to avoid this exception is to make sure you don't load large amount of data into memory or add more memory to your machine.

3 Comments

I mean Model.Refresh(RefreshMode.StoreWins, tablename). The table has 4919653 rows. The reason to do this is that, this table is updated by sql. This changes are not recognized by EF.
I don't know how to help you other than saying: don't load 4919653 rows into memory.
If there any other way to make Entity framework aware of changes made by sql.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.