Blog

All Blog Posts  |  Next Post  |  Previous Post

My Top 10 Aurelius Features - #3 Inheritance

Bookmarks: 

Tuesday, February 21, 2017

How to talk about object-oriented programming and not consider inheritance? In my opinion is a basic "feature" of OOP. And how to talk about an ORM without supporting inheritance? I consider it so important that the simply fact that Aurelius supports it makes it my #3 of My Top 10 Aurelius Features.



It's really nice to be able to model classes and build a class hierarchy, reference classes in that hierarchy from other properties, have a true model that is not just a bunch of plain classes that map properties to database columns. Inheritance support allows you to really think in an OOP way when using an ORM.

TMS Aurelius supports two ways of persisting objects in a class hierarchy in the database:

Joined-tables strategy
Where data from each class is saved in a different database. This is the more normalized way.

Single-table strategy
Where data from all classes are saved in a single table. This is the simplest and often offers better performance.

Regardless of your choice, the facts is that Aurelius allows you to do so! Watch the video above to see how class inheritance works with TMS Aurelius, and if you want to get notified about upcoming videos, subscribe to our YouTube channel!

Wagner Landgraf


Bookmarks: 

This blog post has received 3 comments.


1. Saturday, April 27, 2024 at 8:51:52 AM

Hi Wagner,
in most cases these two strategies will fit all benefits,
but what I''m looking for is a strategy to inherit a base class in multiple tables ( -> Fields ),
to speed up global database changes at one place.

TBase = class
FID : Integer;
FRef : Integer;
FInfo : string;
FDisplay : string;
.....
end;

TPerson = class(TBase)
FName_F : string;
FName_L : string;
....
end;

TAdress = class(TBase)
FZip : string;
FCity : string;
FStreet : string;
....
end;

In a way that Each Child Class ( -> corresponding Table ) holds the Base Class Properties. ( ID, Ref, Info, Display ) + its own properties

regards Wolfgang






Kleb Wolfgang


2. Saturday, April 27, 2024 at 9:02:47 AM

I know your answer :

I don''t think Aurelius ( object orientated ) :-)

Yes I do, but not at these Level.
At the next level, let''s say TContact with Properties : TAdress, TPerson all Aurelius related features are welcome :-)

Kleb Wolfgang


3. Tuesday, April 30, 2024 at 6:23:14 PM

Actually a class-per-table strategy is a valid one, and could be included in Aurelius, yes. But well, it''s not unfortunately, we only provide single-table and joined-tables strategies for now. No current plans to add class-per-table for now.

Wagner 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