I’m trying to pull out an object from a DbSet with a Linq query.
I use the syntax:
Nation nation = nationDB.Nations.Where(c => c.ID == testNation.ID).First();
I get the following exception:
LINQ to Entities does not recognize the method ‘Nation get_Item(Int32)’ method, and this
method cannot be translated into a store expression.
The class Nation has a couple of string fields, one int field (the ID) and a couple of other objects as fields.
What can the problem be?
You need to pull out the integer first because there is no appropriate translation for retrieving the integer from your object
Nationwithin the Linq to Entities scope: