This is a migrated thread and some comments may be shown as answers.

LINQ inner query in ORM not work properly

2 Answers 103 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Amin
Top achievements
Rank 1
Amin asked on 30 Jun 2013, 05:38 AM
Hello My friends.
I'm using open access ORM in my project and have a trouble problem with linq navigation,
 this is my query :
 
var sabet = context.tbl1.Where(i => i.JalaseMSID == JalaseMSID.ToInt() &&
                              (i.tblAezayeJalases ==
null || (i.tbl2 != null &&
                               i.tblAezayeJalases.Any(j => j.tblJalaseID == jalaseID))));

but, when i'm using
int c = sabet.Count();
  to retrieve result count, i got a error message :
Telerik.OpenAccess.RT.sql.SQLException: Subquery returned more than 1 value.
This is not permitted when the subquery follows =, !=, <, <= , >, >= or
when the subquery is used as an expression.
ithink the problem is in inner query(i.tblAezayeJalases.Any) but it return boolean value and no matter how many records being returned,
what can i do?

2 Answers, 1 is accepted

Sort by
0
Amin
Top achievements
Rank 1
answered on 30 Jun 2013, 06:14 AM
i fix this problem with replacing :
i.tblAezayeJalases.Count == 0

instead of
i.tblAezayeJalases == null
:)
0
Alexander
Telerik team
answered on 02 Jul 2013, 02:17 PM
Hi Amin,

I am glad to see that you have found the problem. Indeed, the collections of the persistent classes are always initialized and there is no need to do null checks.

Regards,
Alexander
Telerik
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.
Tags
General Discussions
Asked by
Amin
Top achievements
Rank 1
Answers by
Amin
Top achievements
Rank 1
Alexander
Telerik team
Share this question
or