Wednesday, August 6, 2014

Channel9 Podcast : Entity Framework Tips and Tricks


  • Video URL
  • Entity Framework PowerTools : Shows conceptual model used by DBContext (Which is very relevant for Code-First Model).
  • DBContext API simplified wrapper around ObjectContext API. ObjectContext being detailed one.
  • Explore (in QucikWatch window) ObjectContext.ObjectStateManager to see what all changes have happened so far.

     Important methods in EF (Not covered in above Video)
  • AsNoTracking() : Fetches entities from database in Non- Tracking mode. So changes to the entities won't be tracked.
  • ToTraceString() : This method could be used to find out corresponding SQL statement which would be executed by given Entity Framework query.
  • Translate() : Converts result in DataReader (or DataTable) into Entities. Entities are not added to context by this method call. If you some code in pure ADO.NET and you don't have time or resources to redo it in EF (or it's way easier old way) you can rewire the result into existing objects. 

No comments:

Post a Comment