Blog Options
Archive
<< December 2025 >>-
Monday 22
- Windows Service Deployment Guide for the HTTP.SYS-Ready MCP Server Built with TMS AI Studio -
Monday 15
- Use Your Own Controls in the FNC Filter View -
Thursday 11
- TMS Training Days 2026 -
Tuesday 9
- Next Generation Data Grid for Delphi: Excel Style Selection -
Thursday 4
- Ho Ho Ho! Our TMS Advent Calendar is Coming! -
Wednesday 3
- Next Generation Data Grid for Delphi: Cell Classes -
Tuesday 2
- A New Way of Flexible Filtering with TTMSFNCFilterView
Authors
- Bernard Roussely (3)
- Wagner Landgraf (93)
- Dennis Röhner (1)
- Roman Yankovsky (2)
- Bart Holvoet (41)
- Aaron Decramer (63)
- Pieter Scheldeman (127)
- Nancy Lescouhier (32)
- Adrian Gallero (34)
- Bruno Fierens (446)
- Marcos Douglas B. Santos (5)
- Bernard (4)
- Bradley Velghe (36)
- Andrew Simard (86)
- Holger Flick (15)
- Gjalt Vanhouwaert (44)
- Tunde Keller (33)
- Masiha Zemarai (117)
Blog
All Blog Posts | Next Post | Previous Post
My Top 10 Aurelius Features - #10 Automapping
Monday, December 5, 2016
This is the #10 feature of My Top 10 Aurelius Features. Follow the link for the full list!Using the automapping feature is easy: you just need to add the [Automapping] attribute to your class:
type
[Entity, Automapping]
TCustomer = class
private
FId: Integer;
FName: string;
public
property Id: Integer read FId write FId;
property Name: string read FName write Name;
end;
and it will automatically map the class to the database using some conventions. This prevents you from having to manually use the mapping attributes like Column, Table, Id, etc., to tell Aurelius exactly how the database schema will be.
If you already have an existing database, this is not very useful since the convention used by it will probably not match your existing database. But when you do the code-first approach (my favorite) - where you start your application creating the classes, not the tables - this is very handy.
Besides the obvious fact that Automapping speeds up the development process (prototyping is really fast with it), what I really like about Automapping is how it makes you forget about the database and think only about classes: you just don't remember you have a table or a column somewhere in the database - let Aurelius chooses whatever it needs for the underlying database, and focus on your code.
Another interesting thing is that it's not an all-or-nothing feature: you can have use the Automapping attribute but still override it with specific mapping attributes - so you get the best of both worlds: convention with flexibility:
type
[Entity, Automapping]
TCustomer = class
private
FId: Integer;
[Column('CUSTOMER_NAME', [TColumnProp.Required], 120)]
FName: string;
public
property Id: Integer read FId write FId;
property Name: string read FName write Name;
end;
And to conclude, here is a small video (~4 min) showing Automapping usage:
Wagner Landgraf
This blog post has received 3 comments.
2. Monday, January 9, 2017 at 11:39:32 AM
Manoel, now all videos have Portuguese subtitles. Enjoy! (Todos os vídeos agora tem legendas em português)
Wagner R. Landgraf
3. Thursday, March 23, 2017 at 9:07:23 PM
Obrigado Wagner pela atenção como sempre muito ágil e eficiente.
Napoles
All Blog Posts | Next Post | Previous Post
Manoel Pedro Jr