I have the following code
var dates = query.Select(
x => DateTime.ParseExact(x.Date, "yyyy-MM", CultureInfo.InvariantCulture));
var minDate = dates.Min(x => x);
But When I execute that, I get the exception
System.Data.Entity.dll but was not handled in user code
Additional information: LINQ to Entities does not recognize the method 'System.DateTime ParseExact(System.String, System.String, System.IFormatProvider)' method, and this method cannot be translated into a store expression.
What am I doing wrong? And how I can fix that?