c# - Unable to create a constant value of type 'System.Char' -


i'm getting following error trying group , sum values via linq in ef6:

unable create constant value of type 'system.char'. primitive types or enumeration types supported in context.

i've looked @ half dozen similar questions on stackoverflow , can't find issue. here's query:

var q = c in _context.hoursprovidercosts         c.patientinsurancecompanyname == insurancename             && c.hoursdate >= startdate             && c.hoursdate <= enddate         group c new { c.id, c.patientfirstname, c.patientlastname } g         select new models.insurancecostlistitem         {             patientid = g.key.id,             patientname = g.key.patientfirstname + ' ' + g.key.patientlastname,             total = g.sum(x => x.providerrate)         };  return q.tolist(); 

is in grouping (which i'm new to)? underlying ef6 model fine (i can expand results view of _context.hoursprovidercosts , @ data fine).

thanks

edit: method signature:

public list<models.insurancecostlistitem> insurancecostslistitems(datetime periodstart, string insurancename) { 

try using string literal instead of char literal:

patientname = g.key.patientfirstname + " " + g.key.patientlastname 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -