I need to count the number of the rows in my database with the entity framework. I am using the LINQ method "Count".
Here is the code:
QvDb dba = new QvDb();
if (dba.KUser.Count(us => us.FacebookId == values["FacebookId"]) == 0)
As you can see the values["FacebookId"]
it's a post array variable, and the dba
object variable it's the database model builder.
When I am trying to access to the page i got this exception:
An exception of type 'System.NotSupportedException' occurred in System.Data.Entity.dll but was not handled in user code
Additional information: LINQ to Entities does not recognize the method 'System.String get_Item(System.String)' method, and this method cannot be translated into a store expression.
For the record, the array is not null. It is a string that posted from the form.