I want to load a list of tuples from database. However, when tried like below. I am getting an error "Only parameterless constructors and initializers are supported in LINQ to Entities".
List<Tuple<string, DateTime?>> schdule = new List<Tuple<string, DateTime?>>();
schdule = Entities.ScheduleDates.Where(x => x.Code == cCode).Select(x => new Tuple<string, DateTime?>(x.Key, x.Time)).ToList<Tuple<string, DateTime?>>();
However, by using anonymous types I don't get any error.
var tempSchedule = Entities.ScheduleDates.Where(x => x.Code == cCode).Select(x => new { x.Key, x.Time }).ToList();
Why I am facing the above error.