Blog

All Blog Posts  |  Next Post  |  Previous Post

TMS Aurelius 5 is here! Come see it Live!

Monday, March 22, 2021

TMS Aurelius 5 has been released with lots of new features!

Photo by Tony Hand on Unsplash

Photo by Tony Hand on Unsplash

As we have antecipated in a previous blog post, lots of new features were expected for the next major release of TMS Aurelius, our state-of-art ORM framework for Delphi. And indeed, Aurelius 5 was released last week!

The what's new section in the documentation provides you can see the full list of new features, improvements and bug fixes. Here are the major new features, and at the end of this article we have a special invitation for you!

Data Validation

You can now add data validation via attributes directly to your entity classes.

  [Entity, Automapping]
  [Filter('Multitenant')]
  TTrack = class
  strict private
    FId: Integer;
    [Required] FName: string;
    FGenre: TGenre;
    FComposer: Nullable<string>;
    [Range(0, 3600000)] FMilliseconds: Nullable<Integer>;
    FTenantId: Nullable<string>;
    function GetDuration: string;
  public

All fields will be proper validated according to the validation attributes applied. With a few lines you will guarantee that the entity will be persisted with a valid state.

The above class is part of the Music Library demo provided with TMS Aurelius (trial and registered versions).

Note how the track name is required, and the duration must not be greater than one hour (3600000 milliseconds). If you try to save something with wrong data, Aurelius will automatically prevent the user from doing so and raise an exception:

Data Validation Example

Global filters and multitenancy

Aurelius now includes global filter mechanism. Users will be able to define filters globally, including parameters, and choose which entities will have it applied.

The Music Library demo was made multitenant with a few lines of code. The entities were marked with a new global filter definition:

  [Entity, Automapping]
  [FilterDef('Multitenant', '{TenantId} = :TenantId')]
  [FilterDefParam('Multitenant', 'TenantId', TypeInfo(string))]
  [Filter('Multitenant')]
  TGenre = class
  strict private
    FId: Integer;
    [Required] FName: string;
    FTenantId: Nullable<string>;

And, from that, Aurelius allows you to enforce values in filter (to prevent a wrong tenant id to be saved) and also enable filters to retrieve data:

  Manager.EnableFilter('Multitenant')
    .SetParam('tenantId', CurrentTenant);

That was it! Music Library demo is now multitenant, with a few UI changes to allow the end-user to choose which tenant to use, data is now fully separated between tenants.

Data Validation Example

Attribute-based event handlers

Events are an important feature of any framework, and with Aurelius is not different. It provides several events you can use to add custom business logic. You can add specific code just before an entity is being saved, after an entity is deleted, when an SQL is being executed, among others.

But now you can add event handlers directly in your classes, using attributes. You can use it for logging for example, or even to add custom, more complex data validation.

The Music Library demo also shows how to do it:

  TGenre = class
    {...}
  public
    [OnValidate]
    function Validate: IValidationResult;

{...}

function TGenre.Validate: IValidationResult;
begin
  if SameText(Name, 'Experimental') then
    Result := TValidationResult.Failed('Experimental music is not allowed')
  else
    Result := TValidationResult.Success;
end;

Such validation will be applied, and Experimental genres will not be allowed in our Music Library app!

Come See it Live!

There are more new features, actually: TObjectManager.AddOwnership method, Aurelius Dataset can now refresh fields directly from objects and automatically destroy the source list, etc.

But, what about if you come and see the new features live, in action, with a more deep explanation?

The free webinar "Introducing Aurelius 5" will be held next Wednesday, March 24th, at 4pm UTC at the TMS Web Academy.

In this webinar, Wagner Landgraf, TMS Aurelius architect, will explain to newcomers what TMS Aurelius is about, how to use it, and then show all the new features in action, with real code.

And of course, it will be a live session: you can ask questions and participate! Register now for the "Introducing Aurelius 5" webinar and learn more about this amazing ORM framework!



Wagner Landgraf




This blog post has received 2 comments.


1. Saturday, March 27, 2021 at 3:32:15 PM

It is great to see Aurelius further improve from release to release. Thanks a lot.

Kossow Roland


2. Monday, March 29, 2021 at 12:04:05 AM

Thank you for your long-time support, Roland!

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