Hello,
I'm trying to restrict which propertys of an entity should be included in the json serialization and which should be excluded at runtime.
For example I define my User entity like this:
[Entity]
[Table('user')]
[Id('FId', TIdGenerator.IdentityOrSequence)]
TUser = class
private
[Column('id', [TColumnProp.Required, TColumnProp.NoInsert, TColumnProp.NoUpdate])]
FId: Integer;
[Column('name', [], 50)]
FName: Nullable<string>;
[Column('mail', [], 50)]
FEmail: Nullable<string>;
public
property Id: Integer read FId write FId;
property Name: Nullable<string> read FName write FName;
property Email: Nullable<string> read FEmail write FEmail;
end;
Then I would like to define two service methods which both return a list of users:
...
[HttpGet]
function UserListNoMail: TList<TUser>;
[HttpGet]
function UserListMail: TList<TUser>;
The user serialization of UserListNoMail wouldn't contain the email property at all but the serialization of UserListMail would include the property. Is this possible?