5
Answers

ADO.NET vs entity framework performance Point

K P  Singh Chundawat

K P Singh Chundawat

7y
35.2k
1
Hi,
 
       I am looking for some feedback on performance between using straight SQL commands/connections (ADO.NET) vs utilizing the Entity Framework or Linq for the database work. 
I wanted to get some feedback on a couple questions.

1. I have read that the EF is slower than using straight ADO.NET, but I wanted to get confirmation that that is still the case now with EF 6.0.

2. My second question has to do with structuring my code. Am I better off leaving a connection open the entire time the application is open, or am I better off opening a new connection for each write to the database. With the amount of writes that I am doing I assume I would waste of a lot of time opening and closing connections, but it would also be more stable as the application is multithreaded and could cause locking problems. I know connection poolings come into play there too.

3. Lastly, if ADO.NET is the better path, am I better off using Async calls instead of straight ExecuteNonQueries? The query returns are quick because the generally only update a single record, so I wasn’t sure if that would have an value.

Thanks in advance..
KP Singh Chundawat 

Answers (5)