Blog

All Blog Posts  |  Next Post  |  Previous Post

Introducing the new TMS Aurelius Dictionary

Bookmarks: 

Tuesday, October 12, 2021

TMS Aurelius 5.6 has been released, and the major feature is a brand new, full-feature dictionary.

TMS Software Delphi  Components

Aurelius dictionary is intended to be used in Aurelius queries. The idea is that instead of using strings to reference entity properties, you use the dictionary properties directly. For example, a usual Aurelius query is like this:

Results := Manager.Find<TCustomer>
  .Where(Linq['Name'].Like('M%'))
  .List;
But the above approach is error prone, the 'Name' string can be wrong, it can be wrongly typed, or the name might be modified. You will only find the errors at runtime. With the dictionary, you can write the query like this:
Results := Manager.Find<TCustomer>
  .Where(Dic.Customer.Name.Like('M%'))
  .List;
You can also reference associated objects, for example, querying all invoices where the country of the customer of the invoice is from Brazil:
  Manager.Find<TInvoice>
    .Select(Dic.Invoice.Total.Sum)
    .Where(Dic.Invoice.Customer.Country.Name = 'Brazil')
It's a simple thing that makes a huge difference when you are using it daily. You have code completion, you have compile-time check, you minimize the errors at runtime. In summary, it increases your productivity a lot.

The dictionary now can also be generated in three ways. First, using TMS Data Modeler, when importing the database structure and generating Aurelius entity classes.

Second, if you use a code-first approach (you create your entity classes directly in code), you can generate the dictionary directly from your own application:
TDictionaryGenerator.GenerateFile('C:\SomeFolder\MyDictionary.pas');
Or from command-line using the AureliusDictionaryGenerator.exe tool, which generates it from a BPL package:
AureliusDictionaryGenerator.exe -i:Default -p:"C:\MyProject\Bpl\Entities" "C:\MyProject\MyDictionary.pas"
Last but not least, the dictionary can be validated at runtime! This way, if somehow the dictionary and the real classes do not match (for example, you might modify your classes and forget to generate the dictionary again), the dictionary will tell you the differences:
TDictionaryValidator.Check(Dic);
It's as simple as that. This way you make sure you don't have surprises at runtime and your dictionary is correct!

This is an awesome new feature that brings a night-and-day difference when writing Aurelius queries. If you want to have more detailed information, of course please refer to the documentation where all the above features are explained in details.

Also, Aurelius dictionary feature was covered in the last Behind the Scenes sessions with Wagner Landgraf. The video with replay is below. Please let us know in your comments what did you think about this exciting new feature!



(*) Photo by Mikołaj on Unsplash




Wagner R. Landgraf


Bookmarks: 

This blog post has received 3 comments.


1. Tuesday, October 12, 2021 at 7:09:11 AM

YEAHHH! Great work Wagner.

This is a feature I''ve been waiting for a long time !!

Piffer Claudio


2. Tuesday, October 12, 2021 at 10:13:05 AM

Excellent idea. Definitely easing the whole programming process to have code completion.

Steve JORDI


3. Wednesday, October 13, 2021 at 3:14:39 PM

Thank you Claudio and Steve!

Wagner R. Landgraf




Add a new comment

You will receive a confirmation mail with a link to validate your comment, please use a valid email address.
All fields are required.



All Blog Posts  |  Next Post  |  Previous Post