I have a table named UserTenders
having many-to-one relationship with aspnet_Membership
table.
I am using EntityFramework 4.0 and when I try something like this, it errors.
var tenders = ctx.UserTenders
.Where(tender => tender.HasAdminApproved.Equals(true))
.ToList();
The error is
System.NotSupportedException
Unable to create a constant value of type 'System.Object'.
Only primitive types ('such as Int32, String, and Guid') are supported in this context.
This snippet below works.
var tenders = ctx.UserTenders.ToList();
What could be wrong in my code? Feel like I am missing something very trivial.
I would like to filter all those rows that have the bit
field HasAdminApproved
as true
.Equals
with==
, although it's less elegant..Equals
with ` == `..Where(tender => tender.HasAdminApproved)
?