Why is requiring a field value for non mapped prop


All my Entities are inherited from a same base class, where I add some properties and helper functions.

Look at this simple definition, 

TNaharEntity = class
private
    FInitialized: Boolean;

public
property Initialized: booleand read FInitialized write FInitialized;

There are other properties etc, but at this base class nothing have tags for mapping in aurelius.

I have only added this property and tested the application. When loaded in TAureliusDataSet this property Initialized shows up there.

When the TAureliusDataSet.Post is executed I get the message "Field Initialized must have a value"

What is happening? there is not tag for this property and field, even in the subclasses.

If I remove it, the problem gone. If I change it to a procedure:

procedure   Initialized(ASet: boolean);

procedure TNaharEntity.Initialized(ASet: boolean);
begin
  FInitialized := ASet;
end;

Then it works, no complain for anything and I have my field set.

What is wrong?


"Initialized" property is not nulable, so the dataset considers it as a required field. It's an error at dataset level, not aurelius manager level. You can just declared the property as Nullable<boolean>, or set the Required property of the TField to false.

Or, of course, setting a value for that field in dataset before posting.


See, I dont want that Initialized shows up on the database. It is not mapped for this.

I see that aurelius show some of my public properties of my class as a database fields. That is nice.

However it is not very clear to me how it works, since a few just not show.

I have tested again this initialized chaning it to nullable. Not adding any tag, since it is not meant to be persisted. And the problem remains, it is required.

However I see another property that is also not persisted, Context:IContext that i have created that is showing on the datataset and is also as requited there, but there is no complain with that.

There are properties that I need to expose in my class, and dont want it to be exposed on the TAureliusDataset (or at least do not me cause problems)

other way there are also some properties that are not persisted but I want to show on the dataset to act like calculated fields.

It is not clear how can i control which properties I can hide or not, and how can change the required flag, all my non persisted properties are non required.


I said in the post before, but just to make clear, it is not a database field, is a regular class property.

Actually, is a property from the base class of my entity. What I am understanding is that if Aurelius can map because recognize the data type, it map on the dataset EVEN it is not marked as a database field.

I see that properties that are PROTECTED does not get mapped. that is fine

However not all PUBLIC properties are correct. Not basic types (like lists, or my own types) are not listed on the dataset, that is eventually ok.

Interface type are listed. But as required, however does not cause any problem.


public properties with types AureliusDataset can handle are displayed. If they are not nullable, the TField is marked as required. For better control of what you want to display on the dataset, always define the persistent TField's, as you would do with any dataset.


OK, I understand that, but I just tested several times, even nullable is getting listed as required as tfield and do not let go.

I had to change the code from the 

Property Initialized: boolean read write;

to:
    procedure   Initialized(ASet: boolean);
    function    IsInitialized: boolean;

as the only way to not have to expose the internal variable.


Well, it should define the field as not required. But as I said, you can always define a persistent field and remove the required. Or set a default expression. If you want send me a compilable project that reproduces the problem, I can check it here why the nullable property still creates a required TField.