[fpc-devel] RTTI and Attributes in Delphi 2010
Michael Van Canneyt
michael at freepascal.org
Sun Aug 16 12:49:02 CEST 2009
On Sun, 16 Aug 2009, Paul Ishenin wrote:
> Michael Van Canneyt wrote:
>> I never understood the need for it. RTTI is more than enough
>> for 99.99% of the cases.
> Imagine you have a db framework which maps delphi classes to database tables.
> It reads class properties from the rtti and creates db tables automatically.
>
> For example:
>
> TStudent = class(TPersistent)
> published
> property ID: Integer read FID write FID;
> property Name: String read FName write FName;
> property Age: Integer read FAge write FAge;
> property Group: String read FGroup write FGroup;
> end;
>
> How db framework can create a table based on this information? It needs some
> more info about field types, primary keys.
But that needs to be registered separately anyway, because this varies on
the storage back-end. The object-db mapping should never be in the object
itself, that is bad design.
Michael.
More information about the fpc-devel
mailing list