- This topic has 2 replies, 2 voices, and was last updated 4 years, 10 months ago by .
Viewing 2 reply threads
Viewing 2 reply threads
- You must be logged in to reply to this topic.
Hello
I use few system fields in all tables
How can I create this fields with ORM, but hide those fields in object marshaling?
Hi,
You can define the class with the table attribute and field attributes as you normally would, but at the same time tell it to only marshal tagged properties.
In the example below, you will have a table called person with the fields, ID, Name, Address, Age and CountOfName, but only ID, Name and Address will be marshalled.
The reason is that kbmMW_Root has some default arguments of which one of them is a set of flags that includes [mwrfIncludeOnlyTagged,mwrfIncludePublic].
mwrfIncludeOnlyTagged means that only properties/fields that are tagged with either [kbmMW_Element…] or [kbmMW_Attribute…] will be marshalled.
mtrfIncludePublic means that only fields and properties in the public section of a class will be potentially marshalled.
[kbmMW_Root('person')]
[kbmMW_Table('name:person, index:{name:i1,field:name,descending:false}, index:{name:i2,unique:true,fields:[{name:name,descending:true},{name:age}]')]
TPerson = class
private
FID:kbmMWNullable;
FName:kbmMWNullable;
FAddress:kbmMWNullable;
FAge:kbmMWNullable;
FCountOfName:kbmMWNullable;
public
[kbmMW_Element]
[kbmMW_Field('name:id, primary:true, generator:shortGuid',ftString,40)]
property ID:kbmMWNullable read FID write FID;
[kbmMW_Element]
[kbmMW_Field('name:name',ftWideString,50)]
property FullName:kbmMWNullable read FName write FName;
[kbmMW_Element]
[kbmMW_Field('name:address',ftWideString,50)]
property Address:kbmMWNullable read FAddress write FAddress;
[kbmMW_Field('name:age',ftInteger)]
property Age:kbmMWNullable read FAge write FAge;
[kbmMW_Field('name:countOfName, generator:SEQUENCE, sequenceType:SUBPIVOT, subPivotScope:[FullName], subPivotName:CountOfName',ftInteger)]
property CountOfName:kbmMWNullable read FCountOfName write FCountOfName;
end;
best regards
Kim/C4D
Dear Kim
Thanks!