My Top 10 Aurelius Features - #2 LINQ Projections


Monday, March 06, 2017

LINQ Projections is the runner-up feature of My Top 10 Aurelius Features. It's a sort of "sequel" of the #5 feature LINQ Expressions and Paging, and you can see it in action in the video below.

You could consider that "LINQ Expressions" and "LINQ Projections" are just sides of the same feature. That's not incorrect indeed. But LINQ is a so nice feature of TMS Aurelius that it deserved to be split in two parts. And the reason that projections (and not expression) is ranked higher is just because it's at the core of LINQ.

The coolness of LINQ is more due projections than expressions in my opinion. An expression is actually just a comparison of two projections. It's in the projections that all complexity lies in. And it allows beautiful and complex queries like the following to be written:

Get the unit price and quantity of each order detail, multiply them, and group the sum of it by the year of Order Date.
      .CreateAlias('OrderDetails', 'd')
        .Add((Linq['d.UnitPrice'] * Linq['d.Quantity']).Sum.As_('Value'))
      .Where(Linq['OrderDate'].Year._In([1997, 1998]))
Yes, projections allow you to do grouping, counting, sum, arithmetic operations, extract information from dates like year, month, day, from strings like substring, pos, etc. A full list of available projections is in Aurelius documentation. And everything just translated correctly to the underlying SQL syntax!

Cool, isn't it? You can see queries like the ones above in action, by watching the video above. Don't forget to subscribe to our YouTube channel to get notified about upcoming videos!

Wagner R. Landgraf


This blog post has not received any comments yet.

Add a new comment:
  You will receive a confirmation mail with a link to validate your comment, so please use a valid email address.
Change Image
Fill in the characters from the image above:

All fields are required.

Previous  |  Next  |  Index