Here is my code
var bms = from b in context.bookmark
join q in context.question1Set on b.bookmark_id equals q.question_id
join u in context.userinfo on b.bookmark_ownerid equals u.user_userid
where b.bookmark_ownerid == new Guid(userid.ToString()) && q.question_isdeleted == false //i think it dosent't like the new Guid
select new
{
u.user_username,
q.question_title
};
foreach (var bm in bms)
{
question q = new question();
q.Username = bm.user_username;
q.Title = bm.user_username;
ql.Add(q);
}
The error I get is: Only parameterless constructors and initializers are supported in LINQ to Entities
I have no idea how to fix this. Any ideas?
Construct the Guid before you do the query:
Guid userGuid = new Guid(userid.ToString()); // What type is userid anyway?
var bms =
from b in context.bookmark
join q in context.question1Set on b.bookmark_id equals q.question_id
join u in context.userinfo on b.bookmark_ownerid equals u.user_userid
where b.bookmark_ownerid == userGuid && !q.question_isdeleted
select new
{
u.user_username,
q.question_title
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With