D
deerchao
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!
(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!