Unable to create a constant value of type. Only primitive types or enumeration types are supported in this context 3

asp.net-mvc c# entity-framework-6

Accepted Answer

ZZZ_tmp
226
9/22/2013 1:45:52 PM

Popular Answer

In my situation, I was able to fix the problem by carrying out the following:

I modified the following code:

var r2 = db.Instances.Where(x => x.Player1 == inputViewModel.InstanceList.FirstOrDefault().Player2 && x.Player2 == inputViewModel.InstanceList.FirstOrDefault().Player1).ToList();

To that:

var p1 = inputViewModel.InstanceList.FirstOrDefault().Player1;
var p2 = inputViewModel.InstanceList.FirstOrDefault().Player2;
var r1 = db.Instances.Where(x => x.Player1 == p1 && x.Player2 == p2).ToList();


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow