When will Grouping be supported

23 posts, 1 answers
  1. Alfred Ortega
    Alfred Ortega avatar
    193 posts
    Member since:
    May 2005

    Posted 21 Nov 2008 Link to this post

    I ran (or attempted to run) a Linq Statement with Grouping and found out that that is not supported.  Will that be supported in the next hotfix or version?

    [Edit]
    Are there any other not yet Linq supported features?
    [/Edit]

    Thanks in advance,
    Al
  2. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 24 Nov 2008 Link to this post

    Hi Alfred Ortega,

    why do you want to use grouping? We don't support this yet as we have not seen a good fit for it because of it's semantics wrt. SQL. Be aware, that there is an difference between grouping and nested ordering. Grouping is purely about ordering a new table based on aggregate values, whereas nested ordering allows more flexible sorting.
    SQL Grouping therefore could only return projections like max/min/average/sum, which does not fit very well to an object or class oriented programming. With other words: With SQL grouping you would never get back your persistent objects, but some new artifical structures which contain aggregate information only.

    Best wishes,
    Thomas
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft banner
  4. Alfred Ortega
    Alfred Ortega avatar
    193 posts
    Member since:
    May 2005

    Posted 24 Nov 2008 Link to this post

    Thomas,
    I do want the aggregrate functionality so I think it's very useful.  Here is a scenario that I'm using for.  A user conducts a search of vehicles entering in their search criteria in a TextBox - pretty standard.  Now they get x number of results based on that search.  I'm not going to show all of them, they are going to get paged 10 or 25 at a time or something - again pretty standard.  I also want a tag cloud based on their search and the weight of the tag is the count of tag for vehicles matching their search so it is an aggregrate need.

    I was also going to do it using a view but openaccess doesn't seem to support them via the wizard yet and I don't know enough about the config files to play with it. 

    Also as more and more people get familiar with Linq they will expect that standard Linq functionality and slightly more advanced functionality (grouping, joins, max, min) will be supported by products that say, "Use familiar LINQ constructs when you query your database" like your site says. :-)

    Al
  5. Alfred Ortega
    Alfred Ortega avatar
    193 posts
    Member since:
    May 2005

    Posted 26 Nov 2008 Link to this post

    So will grouping be supported?

    Al
  6. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 26 Nov 2008 Link to this post

    Hello Alfred,

    yes, grouping will be supported in a future version (this future is not that far away). An exact date cannot be given yet and depends on the approved roadmap.

    Greetings,
    Thomas
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. joshuarivers
    joshuarivers avatar
    21 posts
    Member since:
    Jul 2007

    Posted 05 Dec 2008 Link to this post

    It's worth noting that there are several work-arounds here.

    You can manually map to a View which has your grouped information.
    You can wait for Q1 and use sprocs to return your grouped information.
    You can return the whole set and use linq to group and aggregate client side.

    That all said, I just built my first sample app with OpenAccess, and the _second_ thing I grabbed for was grouping. Priority for the roadmap, please!
  8. Peter Brunner
    Admin
    Peter Brunner avatar
    89 posts

    Posted 05 Dec 2008 Link to this post

    Hi Alfred,

    we appreciate your feedback. It is on the roadmap for Q2/2009 and got priority. If we have a chance to move it into Q1 we will do.

    Sincerely yours,
    Peter Brunner
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  9. joshuarivers
    joshuarivers avatar
    21 posts
    Member since:
    Jul 2007

    Posted 05 Dec 2008 Link to this post

    Eh. Not alfred. But thanks!
  10. Alfred Ortega
    Alfred Ortega avatar
    193 posts
    Member since:
    May 2005

    Posted 05 Dec 2008 Link to this post

    Thanks!  What about joins, and other Linq functionality?  Will it be a full Linq implementation?
  11. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 08 Dec 2008 Link to this post

    Hello Alfred Ortega,

    what is that you really need to have? LINQ can be complex to implement, and some features might not be necessary to have in the first place. Explicit joins f.e. can be much more efficiently expressed by using the corresponding references in the object model. And server side method execution will be limited to things expressable in T-SQL/PLSQL ...

    Best wishes,
    Thomas
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  12. Alfred Ortega
    Alfred Ortega avatar
    193 posts
    Member since:
    May 2005

    Posted 08 Dec 2008 Link to this post

    I'll give you a list that would work for me and try to be specific so that is hopefully of value to you.  Also you may have some of these implemented and if so I apologize I haven't had a lot of time to test everything - ;-)

    1) Aggregrate functions.  Grouping, Avg and Sum specifically
    2) Anonymous types - I think you have this already.
    3) Column functions - StartsWith, Contains, EndsWith etc...
    4) Skip/Take and Single - I think you have this already too.
    5) Joins.  Yes you can do them via PL/SQL or T-SQL but the point of Linq is to abstract that away so I don't have to. In some cases like simple joins the SQL is pretty simple so the overhead of the extra sproc/packages is unneeded.

    Things I'm not really too concerned with and can wait.

    1) Lambda expressions
    2) Reverse - After all I can just sort desc...
    3) Range - We've got skip/take so I'm happy with that.

    Hope that listing helps you
    Al
  13. joshuarivers
    joshuarivers avatar
    21 posts
    Member since:
    Jul 2007

    Posted 08 Dec 2008 Link to this post

    Something I've been thinking about is that in addition or alternative to the LINQ support for queries/projections I'd like to see:

    Mapping of arbitrary SQL queries to read-only objects/collections. I'd like to go into the mapping wizard, and enter a query and have it create a class based on the result so that I can bind my grids and UI to it and access the data simply.

    Example: I have a grid that shows all of the Employees that use the site. However, the column with LastLoginDate exists over in the User Table. I want the dataaccess code to give me an object that I can pass through my controller into my web form to display this information, but I don't need any of the complexity of an object hierarchy or the unbindability of child properties.

    Is that a useful suggestion?
  14. Alfred Ortega
    Alfred Ortega avatar
    193 posts
    Member since:
    May 2005

    Posted 08 Dec 2008 Link to this post

    Joshua,
    That's why I want to have the joins done so that you could bind your grid to something like this:

                        var query = from users in scope.Extent<User>()
                                    join userdata in scope.Extent<UserData>()
                                    on users.UserID equals userdata.UserID
                                    select new
    
                                    {
                                        ID = users.ID,
                                        LastName = users.LastName,
                                        FirstName = users.FirstName,
                                        LastLogin = userdata.LastLogin
                                    };


    Now you have an anonymous class based on a join - no extra classes or views needed.
  15. joshuarivers
    joshuarivers avatar
    21 posts
    Member since:
    Jul 2007

    Posted 08 Dec 2008 Link to this post

    ....which is good. Definitely.

    However, you can't pass that projection between layers of your app, can you? Nor can you add extensions to it like:

    string Fullname
    {
    get { return Firstname + Lastname;}
    }

    Most importantly, you can't tell a gridview to use it as a datatype, so you have to create all of your column definitions by hand, which slows down the UI velocity a lot.

    I guess you can hand-build your DTOs and linq into them...but couldn't we just have the wizard do it?
  16. Alfred Ortega
    Alfred Ortega avatar
    193 posts
    Member since:
    May 2005

    Posted 08 Dec 2008 Link to this post

    I agree that would be great.  Would you like to extend the list out?  Obviously my list is a little biased towards what I need but you have some good ideas.  Telerik ---?
  17. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 10 Dec 2008 Link to this post

    Hello Alfred & Joshua,

    as mentioned before, the UI is not fast bindable to types which are created at runtime. What is coming out of the query is basically a collection of object arrays where each array element is a projected column. The only way to make that easily bindable is to transfer the content into a real field of a non-anonymous class; something similiar is happending with the select new statement. So possibly all you would need is a constructor which does the transferral. When then the user defined projection class is usable in all app layers too.

    The question I have when seeing this example is why an explicit join is needed:

              var query = from userdata in scope.Extent<UserData>()
    select new
    {
    ID = userdata.User.ID,
    LastName = userdata.User.LastName,
    FirstName = userdata.User.FirstName,
    LastLogin = userdata.LastLogin
    };
    This assumes that UserData has a reference to its User via the User property, and by following that reference the join is automatically made.

    StartsWith, EndsWith, Contains, ToUpper, ToLower are already supported.
    Average, Sum, Min, Max, Count are supported for non-grouping queries.

    Kind regards,
    Thomas
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  18. Alfred Ortega
    Alfred Ortega avatar
    193 posts
    Member since:
    May 2005

    Posted 10 Dec 2008 Link to this post

    GROUPING:
    I saw that the aggregates where done, but for me they need to have the grouping functionality.  The page shows 3 things:

    1) A grid of x records - easily accomplished with Skip/Take

    2) Total # of records because we need to set the virtual page count on the grid for custom paging - easily accomplished with Count();
    3) For all possible results I need a list of the categories and the amount of times they appear for a tag cloud.  This is where Linq can do it, but OpenAccess can not.  It seems OA can not perform this action via Linq or OQL


    JOINS:
    I just put the join in there because although it was a natural join LInq supports other join types as well (http://msdn.microsoft.com/en-us/library/bb311040.aspx).  I believe the statement would require a reference to the joined class first though...


              var query = from userdata in scope.Extent<UserData>()
                    select new
                    {
                      ID = userdata.User.ID,
                      LastName = userdata.User.LastName,
                      FirstName = userdata.User.FirstName,
                      LastLogin = userdata.LoginInfo.LastLogin
                    };

    -Al

  19. joshuarivers
    joshuarivers avatar
    21 posts
    Member since:
    Jul 2007

    Posted 10 Dec 2008 Link to this post

    What you're proposing to solve my join issues sounds like it would work.....but it also confuses me totally.

    The simple case here isn't so bad, although it's still a shift for me. But what about more complex cases? What about when I have a number of different 'projections' of my data into my object graph. Mapping tables into objects is GREAT. It saves a lot of work right off the top. But working with legacy databases, I definitely find that the objects I want to use join together bits from different tables, and not just in a master-details or parent-collection way. Do I need to build out query groups and the like for each of these 'projections'? What are the performance implications? Does joining three tables together by creating a new class and populating it off the object graph really only only perform a single sql query?

    The real frustration is that this stuff ought to be easy. Pick up an "ASP.NET in 20 Minutes" book, and it will show you how to get arbitrary data out of an SQL server and bind it to your UI lickety-split. The problem is that you end up with a horrible program that's not testable or extensible or ....

    I would assume that most of what I'm looking for will be supported when Views and Stored Procedures are supported, but we really shouldn't have to modify the DB to do these things. If it can be done from a view or sproc, it should be do-able from arbitrary sql, or Linq. (Or perhaps I have no idea what I'm talking about <grin>)

    I'm really excited about OpenAccess, and I'm here because data access in my projects has been like swimming through mud. I'm tired of that. And 10 minutes of working with nHibernate makes me really want...a wizard.
  20. Answer
    Dimitar Kapitanov
    Admin
    Dimitar Kapitanov avatar
    632 posts

    Posted 12 Dec 2008 Link to this post

    Hello joshuarivers,
    We escalated the priority of having well implemented Grouping functionality inside our LINQ provider library. You can expect the enhancements to be available early next year. And just to clarify, I am not able to give you exact time-frame at the moment.

    All the best,
    Dimitar Kapitanov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  21. joshuarivers
    joshuarivers avatar
    21 posts
    Member since:
    Jul 2007

    Posted 12 Dec 2008 Link to this post

    Fantastic. You guys are the best!
  22. Alfred Ortega
    Alfred Ortega avatar
    193 posts
    Member since:
    May 2005

    Posted 12 Dec 2008 Link to this post

    Thank you very much!
  23. Himadri Shekhar
    Himadri Shekhar avatar
    1 posts
    Member since:
    Jan 2009

    Posted 01 Jan 2009 Link to this post

    I have created a view in my SQL server 2005 database.
    I want to access the view through Persistant class.
    Is it possible to access a view using ORM?
    Please suggest.

    Thanks.
  24. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 02 Jan 2009 Link to this post

    Hello Himadri Shekhar,

    this thread was dealing with a different topic.

    To answer your question: Currently there is no support for views, but this topic is on our agenda.

    Best wishes,
    Thomas
Back to Top
DevCraft banner