Why is Linq to Entity Select Method flip flopping projected lists properties? Why is Linq to Entity Select Method flip flopping projected lists properties? json json

Why is Linq to Entity Select Method flip flopping projected lists properties?


Try

var output = db.FooBar.Where(a => a.lookupFoo == bar)                  .Select(a => new List<double>{                                 //value's are the same per row                                  //for demonstration sake.                      a.fooBarA,  //Always 12.34                      a.fooBarB,  //Always 12.34                      a.fooBarC,  //Always 0                      a.fooBarD  //Always 0 //lazy casting to double from int                  }).toList();return Json(output);

On your way output just context the generated script for get datamay be it Excute manytime in size Json()


Add a .ToArray and see what you get. Remember that the linq (Select.. exc) is only executed when IEnumerator is called.

I think if you add ToArray, the result would be the same each time, and consistent.

Hope that helps.