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

Collection Fields

5 Answers 180 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Pål
Top achievements
Rank 1
Pål asked on 04 Dec 2008, 11:41 AM
Hi.

My project fails on my LINQ test to do the following:

 

// Create LINQ query for all customers who have placed more than ten orders
var result =
from customer in scope.Exctent<Customer>()
where customer.Orders.Count > 10
select customer;

Exception: {"Projecting collection fields not supported yet."}

I also tried "Count()" intstead of just "Count":

Exception: {"Not implemented: Execution of 'Enumerable.Count' on the database server side currently not implemented."}

This is a quite simple and common (i believe) query. Is this something you will implement in the near future?

Regards

Paul

 

 

 

 

 

5 Answers, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 05 Dec 2008, 08:47 AM
Hello Pål,

the upcoming version does not have the issue. It should be available within 2 days.

Sincerely yours,
Thomas
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Pål
Top achievements
Rank 1
answered on 09 Dec 2008, 01:44 PM
Hello Thomas!

Downloaded the latest version, and one of my teo tests passed.

The "Count()" version still throws an exception:

{"Not implemented: Execution of 'Enumerable.Count' on the database server side currently not implemented."}

Still, half way there... :-)

Thanks.

Pål
0
Thomas
Telerik team
answered on 10 Dec 2008, 12:57 PM
Hi Pål,

you are right, there is an exception. However, the reason is because the type of the Orders property is IEnumerable<Order>. And IEnumerable<Order> does not have itself a Count() method, but one is provided as extension method from Enumerable.Count().
If you use ICollection<Order> type as property type for the Orders property, then the correct query is executed.

Greetings,
Thomas
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Devanand Chahal
Top achievements
Rank 2
answered on 24 Jun 2009, 10:31 AM

Hi Thomas,

I am trying to use contains (equivalent to IN clouse in sql) to filter my data, I am using oracle as backend insted of Sql Server. See my code below:

string

 

[] arrCode = new string[2]; 

 

 

arrCode[0] =

"AAA";  

 

arrCode[1] =

"BBA"

 

 

var result = from c in scope.Secure<MtCurrency>() 

 

where (c.CurrencyCode.Matches(searchText) || c.CurrencyDescription.Matches(searchText)) && arrCode.Contains(c.CurrencyCode.ToString()) 

 

 

 

select c;

When I test this code in WebOrb, I got error: 
"Execution of 'System.Linq.Enumerable:Contains' on the database server side currently not implemented"

Please suggest me where I am wrong ? If I run this query without using contains then its working fine.

Regards,
Devanand Chahal    
CPA Global

 

 

0
Thomas
Telerik team
answered on 25 Jun 2009, 03:59 PM
Hi Devanand,

this is an issue with the detection of the System.Linq.Enumerable:Contains method. If you use a List<string> instead of the string[] for the arrCode, everything should work.
We will try to fix that as soon as possible.

Kind regards,
Thomas
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
LINQ (LINQ specific questions)
Asked by
Pål
Top achievements
Rank 1
Answers by
Thomas
Telerik team
Pål
Top achievements
Rank 1
Devanand Chahal
Top achievements
Rank 2
Share this question
or