public static IEnumerable <object> FindPrimaryKeyValues <T>(this DbContext dbContext, T entity) => from p in dbContext.FindPrimaryKeyProperties(entity) select entity.GetTypePropertyValueAs(p.Name);
public static IEnumerable <string> FindPrimaryKeyNames <T>(this DbContext dbContext, T entity) => from p in dbContext.FindPrimaryKeyProperties(entity) select p.Name;