Linq to Entities Group By (OUTER APPLY) "oracle 11.2.0.3.0 does not support apply"
Since you could write the query yourself. Maybe you can create a stored procedure with it and call the SP from Entity Framework.
You can try executing ToArray before the GroupBy, so it executes in memory. It won't be optimal performance, but should work.
var productResults = Products.Where((p) => refFilterSequence.Contains(p.Ref)).ToArray() .GroupBy(g => g.Code, (key, g) => g.OrderBy(whp => whp.Ref).First()).ToList();