0

We have a requirement to read a load of xml files, run validation on them, transform them into entities and stores them in the database. This was being done using a repository wrapping Entity Framework.

What we have found is that Entity Framework slows the process down to the point where it doesn't process the records quickly enough. We profiled the application and the worst performing method was the SaveChanges on the EF context.

We are thinking of introducing threading as a possible solution.

Has anyone any other ideas of how we can speed up the process?

4

1 Answer 1

0

I had this problem for csv files one time. The problem was that I tried to save all my records with only one SaveChanges() because transaction was required.

I divided it (1 for 1000 records) and it resolves my performance problem. Also, you can try to disable auto detect changes during your threatment.

I hope it helps :)

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.