I would like to return a list of keypairvalues from a linq query but when I do I get
Only parameterless constructors and initializers are supported in LINQ to Entities
I think this is because a KeyValuePair does not have a empty constructor but there has to be a way to return a list of keypairvalues in a linq statement maybe use .ToDictionary() or something ?
See my query below
{
List<KeyValuePair<string, string>> sup;
sup = (
from s in db.LU_opcoVendor
.GroupBy(x => x.supplierNumber)
.Select(x => x.FirstOrDefault())
join su in db.suppliers on s.supplierNumber equals su.supplierNumber
select new KeyValuePair<string, string>(s.supplierNumber, su.supplierDesc))
.ToList();
}