How to Use EF properly


EF is a ORM framework which make developer’s life easier (do not need to spend so much time on writing sql)

However, using EF is not a easy task. Here are some helpful tips while we use EF;

  1. Ensure we filter the data at the database level (ToList and ToArray filter inside memory and not at sql level.)
  2. Complicated query need to be separated into small chunks because EF are not good at solving that.
  3. when it comes to a complex query, we can use stored procedure to do it.
  4. EF track any changes of the objects inside. you can create some outside object.
  5. we need to slowly insert records into database
  6. add the right indexing is super important
  7. use sql profiler would be helpful.

 

Social Media


Categories



All Posts



Contact Info