Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Entity, problem with entity key (http://www.velocityreviews.com/forums/t697370-entity-problem-with-entity-key.html)

ThatsIT.net.au 09-06-2009 09:47 PM

Entity, problem with entity key
 
The query below does not work, if I take out line 2 it works and gives me
the full table, but when I try to select only those with a coutryId of 1 it
gives this error

LINQ to Entities does not recognize the method 'System.Object
CompareObjectEqual(System.Object, System.Object, Boolean)' method, and this
method cannot be translated into a store expression.

My experience tell me this is a problem with passing the wrong datatype, but
CountryId is an integer and even if I change it to a number 1 it still give
the same error.

any ideas?


Dim Q As ObjectQuery(Of emState) = CType((From c In em.emStateSet _
Where
c.CountryReference.EntityKey.EntityKeyValues.First .Value = CountryId
Select c),
ObjectQuery(Of emState))


ThatsIT.net.au 09-07-2009 02:20 AM

Re: Entity, problem with entity key
 
silly me

I dug up my lats effort in linq to entities and what i should of had was

Using em As ThatsBookingEntities = New ThatsBookingEntities
Dim Q As ObjectQuery(Of emState) = CType((From c In
em.emStateSet _
Where
c.Country.CountryId = CountryId _
Select c),
ObjectQuery(Of emState))



"ThatsIT.net.au" <me@work> wrote in message
news:D602837E-F290-4CE2-9920-1BC00E90DF23@microsoft.com...
> The query below does not work, if I take out line 2 it works and gives me
> the full table, but when I try to select only those with a coutryId of 1
> it gives this error
>
> LINQ to Entities does not recognize the method 'System.Object
> CompareObjectEqual(System.Object, System.Object, Boolean)' method, and
> this method cannot be translated into a store expression.
>
> My experience tell me this is a problem with passing the wrong datatype,
> but CountryId is an integer and even if I change it to a number 1 it
> still give the same error.
>
> any ideas?
>
>
> Dim Q As ObjectQuery(Of emState) = CType((From c In em.emStateSet _
> Where
> c.CountryReference.EntityKey.EntityKeyValues.First .Value = CountryId
> Select c),
> ObjectQuery(Of emState))




All times are GMT. The time now is 05:31 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.