title: Checking for duplicate rows using Entity Framework in C#
body: <p>Using Entity Framework 6.x.  For some entities after I create a new instance of an entity object and populate it with data values, I would then like to be able to trigger a lookup on the database. I would like to see if a row exists with all the same values that where populated into the entity object and if it exists return the primary key.</p>
  
  <p>It seems logical that there should be a standard way to do this built into the entity framework but I can't find it.  It would be nice if there was a method that would just take any entity object and return the primary keys of any matching rows.</p>