Entity Framework - Using a list as a paramater in a compiled query

Posted by vdh_ant on Stack Overflow See other posts from Stack Overflow or by vdh_ant
Published on 2010-04-21T22:05:53Z Indexed on 2010/04/21 22:13 UTC
Read the original article Hit count: 462

Hi guys

Just wondering if anyone knows whether I should be able to pass in list into a compiled query and have the query perform a contains operation?

The reason why I ask is that I have a scenario where I need to do this, yet at run time I am getting the following error...

The specified parameter 'categories' of type 'System.Collections.Generic.List`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' is not valid. Only scalar parameters (such as Int32, Decimal, and Guid) are supported.

I can understand why this might be the case but I was wondering if anyone knows a way around it.

Cheers Anthony

© Stack Overflow or respective owner

Related posts about entity-framework-4

Related posts about compiled-query