The specified parameter ‘list’ of type ‘….’ is not valid. Only scalar parameters (‘such as Int32, String, and Guid’) are supported.

I recently migrated over to .Net 4.0 to get access to the L2E Contains support (Where In decomposition). Whilst MSDN does suggest that it is supported in Entity Framework 4.0, I found that it doesn’t seem to work in pre-compiled queries. It seems that pre-compiled queries can only accept scalar parameters

“The arguments to a compiled query all need to be scalars because they all become parameters to the generated database command and these can only be scalars.”

In the end I resorted to a dynamic query using expression trees.

Advertisements

One comment

  1. Sahil Gupta

    Check for the entity respository. Sometimes it gives error because of mismatch of entities on which operations are being performed.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s