Hi I use Linq and EF 4.
I have this query, but it seems not able to order the result by a string variable sortExpression
.
I suppose I'm doing smt wrong in "it."
part.
Notes: sortExpression
could have like Title
Could you please have a look and tell me what is wrong in my syntax? Thanks for your help
var myContentsForAuthor = from c in context.CmsContents
join a in context.CmsAuthors on c.AuthorId equals a.AuthorId
join u in context.aspnet_Users on a.UserId equals u.UserId
orderby("it." + sortExpression)
where u.UserId == myUserGuid && c.IsDeleted == false && c.Title.Contains(nameSearchString)
select c;
return myContentsForAuthor.ToList();