setpropvalue problem

Hi Folks,

Given Entity TPerson and Property FirstName I can do 

MyPerson ;= TPerson.Create;
MyPerson.FirstName := 'Greg';

But using typinfo.pas and Delphi RTTI

does not recognise 'FirstName' as a property of MyPerson.

and GetPropInfo(MyPerson,'FirstName') returns nil

Can I do something like Myperson.Props['FirstName'] := 'Greg' on a regular property as it is on Dynamic properties?

A workaround I know is to use the Aurelius Dataset and Fieldbyname('FirstName') but I would rather not.

Cheers Greg

Such methods are the "old" RTTI, pre-2010, which only works for published properties. If you put your FirstName property in the published section of your TPerson class, you will be able to achieve what you want. Otherwise, you would have to use the new RTTI classes. Some references:

Thanks Wagner, 

I am glad I did not pick up on the published properties, obvious in hindsight, as I would not have discovered all the new RTTI features post 2010.