Virtual Fields as Calculated Fields

Hi there,


Not sure if this is possible:

I am loading the fields definition on TAureliusDataSet using the package with the Entities. It is very handy.

But since an Entity is a class, and the idea is all about working with classes, I wonder how could i expose some of the properties of my entity class in TAureliusDataSet as a field, probably as a Calculated field. However this field should not be persisted.

One of the advantages of using class is that I could have more properties available as helpers for the application, keeping the business logic in one place.

I have for example, and extended description for a item group, that I wanted to expose like a property on the entity class, this property give me the description ready for use, based on data of the record. But that description should not be persisted.

How?

Eduardo

I made an experiment and I see that Aurelius let me add a property in my entity with no tags defined (it is not a table column) and it show up on TAureliusDataSet, that is very nice.


However is seems not working, My property is very simple:

property Test: string read gettest;

function TEntity.GetTest
begin
  result := 'teste';
end;

On the view, using livebinding I connected this property to a TEdit. I was expecting to see the 'test' value there.

Is it supposed work this way?

Eduardo

Yes, it should work fine. TAureliusDataset is not limited to the mapped properties.

Thanks for the answer...


However I see that the value is not assigned.

In this test property there is not field defined on the class, just the direct return of the getter.

The other properties are working and I can save/retrieve the objects from the database.

Any Clue?

The property value? If the property only has a getter, how do you expect it to be set?


property Test: string read gettest;

Sure you right, however I expressed myself wrongly... I meant that TEdit is not getting the value.


Besides the property is readonly, I was just trying to read it and could make it happen. The value READ is always "blank" 

I don't know details of your code/application or what you trying to do, so I can't tell what's going on. Usually, it should work, I don't see anything wrong.