Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
Trying to do some custom sql magic. Currently have this:
var classSql = new Sql() .Select("*") .From<SchoolClass>(_syntax) .Where<SchoolClass>(x => x.MemberId == id) .OrderBy<SchoolClass>(x => x.Name, _syntax); var schoolClasses = _db.Fetch<SchoolClass>(classSql); var schoolIds = schoolClasses.Select(x => x.SchoolId).Distinct(); var schoolSql = new Sql() .Select("*") .From<School>(_syntax) .Where<School>(x => schoolIds.Contains(x.Id)) .OrderBy<School>(x => x.Name, _syntax); var schools = _db.Fetch<School>(schoolSql);
But it gives me an exception
variable 'x' of type 'MyProject.Pocos.School' referenced from scope '', but it is not defined
I am trying to fetch all the schools from the schoolClasses.
Whats wrong?
Found out, I need to use .WhereIn instead of .Where
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Fetch from custom sql where id is in array
Hi
Trying to do some custom sql magic. Currently have this:
But it gives me an exception
I am trying to fetch all the schools from the schoolClasses.
Whats wrong?
Found out, I need to use .WhereIn instead of .Where
is working on a reply...