Was trying to write very simple Linq statement today (below) and I received the following error
Error Message Received
"LINQ to Entities does not recognize the method 'System.Guid get_Item(Int32)' method, and this method cannot be translated into a store expression."
Of course when I received this I was take back because at first glance I assumed it was trying to convert my GUID to an int and we all know this is not possible. I then thought maybe I was testing against the wrong column in the database table, but that was not the case.
I have to say I was a bit at a loss, at lease for a second. I had a theory so I changed my code to look like below:
And of course this code WORKED.
Notice that the ONLY thing I changed was I pushed the Video ID out of the array and into a local variable prior to using Linq. Turns out that that Linq is not able to use array indexers for GUID arrays, or at least that is my take on why this is not working based on the error.
Long story short is if you get this error try pushing your array item into a local variable rather than trying to access it via an array indexer.
Till next time,
P.S. If you want to learn more about Knockout watch my Pluralsight Course on Knockout JS
P.S.S. If you want to learn how to transition your XAML skills to HTML you
can watch my course on Html for the XAML
06-05-2013 6:24 AM