Blog Options
Archive
<< April 2024 >>-
Wednesday 17
- New free component for sophisticated file uploads with TMS WEB Core -
Tuesday 16
- Closing the gap with TMS FNC UI Pack new additions -
Thursday 11
- Unveiling the Latest Enhancements in TMS VCL UI Pack -
Friday 5
- TMS components and Delphi and C++Builder 12.1 -
Wednesday 3
- Customizing the login page of your application using TMS Sphinx
- A Python library for using StellarDS.io effortlessly
- Introducing: How it Works with Holger - Building a Pexels gallery app with TMS WEB Core video series
- TMS FNC Cloud Pack with StellarDS.io backend: unparalleled productivity in VCL & FMX
Authors
- Bernard Roussely (1)
- Wagner Landgraf (82)
- Roman Yankovsky (2)
- Bart Holvoet (27)
- Aaron Decramer (17)
- Pieter Scheldeman (99)
- Nancy Lescouhier (32)
- Adrian Gallero (33)
- Bruno Fierens (403)
- Marcos Douglas B. Santos (5)
- Wagner R. Landgraf (1)
- Bradley Velghe (16)
- Bernard (2)
- Andrew Simard (86)
- Holger Flick (15)
- Gjalt Vanhouwaert (30)
- Tunde Keller (22)
- Masiha Zemarai (119)
Blog
All Blog Posts | Next Post | Previous PostMy Top 10 Aurelius Features - #5 LINQ Expressions and Paging
Bookmarks:Monday, January 30, 2017
Most examples and quick-start tutorials about ORM frameworks explain how to insert, update and retrieve single entities in the database. But not many of them go further and show how to perform a query in the database. Maybe because that's something that the developer will only need after many data is inserted, and it's something that is only heavily needed when the application development is at a more advanced stage. However, it's a very important feature, and that's why "LINQ Expressions and Paging" is my #5 feature of My Top 10 Aurelius Features.The reason for that is because you can really query your entities in a object-oriented way. It's not some SQL-like string you build, or SQL WHERE statement that you simply inject. It's really about querying object properties, comparing their values in Pascal (not in database), and using Pascal syntax to build the queries. Take a look at this example:
MyCustomers := Manager.Find<TCustomer> .Where( ( (Linq['Birthday'] > EncodeDate(1981, 10, 10)) and (Linq['Birthday'] < EncodeDate(1986, 2, 2)) ) or ((Linq['Sex'] = tsFemale) or Linq['Sex'].IsNull) or Linq['Name'].Contains('Walker') or Linq['Status']._In([TCustomerStatus.Active, TCustomerStatus.Prospect) ) .OrderBy('Name') .List;
Finally, a small feature of LINQ filtering that I enjoy a lot: paging. It's very simple to use and very handy:
MyCustomers := Manager.Find<TCustomer> .Take(10).Skip(50) .OrderBy('Name') .List;
To see in details how LINQ expressions and paging works, watch the video above, and if you want to get notified about upcoming videos, subscribe to our YouTube channel!
Wagner Landgraf
Bookmarks:
This blog post has not received any comments yet.
All Blog Posts | Next Post | Previous Post