Collection Fields

6 posts, 0 answers
  1. Pål
    Pål avatar
    53 posts
    Member since:
    Sep 2012

    Posted 04 Dec 2008 Link to this post

    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

     

     

     

     

     

  2. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 05 Dec 2008 Link to this post

    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.
  3. DevCraft banner
  4. Pål
    Pål avatar
    53 posts
    Member since:
    Sep 2012

    Posted 09 Dec 2008 Link to this post

    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
  5. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 10 Dec 2008 Link to this post

    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.
  6. Devanand Chahal
    Devanand Chahal avatar
    26 posts
    Member since:
    Mar 2009

    Posted 24 Jun 2009 Link to this post

    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

     

     

  7. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 25 Jun 2009 Link to this post

    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.
Back to Top
DevCraft banner