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 - #10 Automapping
Bookmarks: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
Bookmarks:
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