Linq 2 sql, enum, no supported translation to SQL
- From: deerchao <deerchao@xxxxxxxxx>
- Date: Mon, 23 Jun 2008 21:23:56 -0700 (PDT)
Hi, I'm using linq 2 sql, and I specified a custom enum type
(CompanyType) to one of the Company table field.
When I'm querying like this:
IEnumerable<CompanyType> validTypes= ...;
var v = from c in db.Companies
where validTypes.Contains(c.CompanyType)
select c;
I got an exception says:
Method 'Boolean Contains(MyNamespace.CompanyType)' has no
supported translation to SQL.
If I use int instead of "MyNamespace.CompanyType" as the type of
property "CompanyType" (and the IEnumerable<int> validTypes),
everything works. So what should I do to make my custom enum types
work?
Thanks!
.
- Follow-Ups:
- Re: Linq 2 sql, enum, no supported translation to SQL
- From: deerchao
- Re: Linq 2 sql, enum, no supported translation to SQL
- Prev by Date: Re: Memory Leak
- Next by Date: Re: Linq 2 sql, enum, no supported translation to SQL
- Previous by thread: dynamic winforms UI
- Next by thread: Re: Linq 2 sql, enum, no supported translation to SQL
- Index(es):