public void t() { using (testEntities context = new testEntities()) { var q = from d in context.Computers join l in context.Computers on d.Id equals l.Id where (d is DesktopComputer) select new { d.Id, d.Brand }; foreach (var o in q) { } } }