protected override IQueryable <TEntity> GetEntityByKeyQuery(TKey key)
 {
     return(EntityKeyFunction <TEntity, TKey> .QueryWhereKeyMatches(GetBaseQueryable(), key, EntitySetMetadata.ElementTypeMetadata));
 }
        protected override TKey GetKey(TEntity entity)
        {
            Func <TEntity, TKey> entityKeyFunc = EntityKeyFunction <TEntity, TKey> .GetEntityKeyFunction(EntitySetMetadata.ElementTypeMetadata);

            return(entityKeyFunc(entity));
        }