Hi, I'm new to XData so trying to get the basics. I have defined the following entities but have an issue in that I want the Id and the CreatedAtDateTime to be readOnly, so they appear in the GET's Response but not in the Body for the POST/PUT in the swagger. Is there an easy way to do this please?
unit uPartyModel;
interface
uses
SysUtils,
Generics.Collections,
Aurelius.Mapping.Attributes,
Aurelius.Types.Blob,
Aurelius.Types.DynamicProperties,
Aurelius.Types.Nullable,
Aurelius.Types.Proxy,
Aurelius.Dictionary.Classes,
XData.Service.Common,
XData.Model.Attributes,
System.DateUtils;
type
TParty = class;
[Entity]
[UriPath('parties')]
[Table('PARTY')]
[id('FId', TIdGenerator.Uuid36)]
TParty = class
private
[Column('ID', [TColumnProp.Required, TColumnProp.Unique , TColumnProp.NoUpdate], 36)]
FId: string;
[Column('FIRST_NAME', [TColumnProp.Required], 100)]
FFirstName: string;
[Column('LAST_NAME', [TColumnProp.Required], 100)]
FLastName: string;
[Column('MOBILE', [], 20)]
FMobile: Nullable<string>;
[Column('LANDLINE', [], 20)]
FLandline: Nullable<string>;
[Column('EMAIL_ADDRESS', [], 100)]
FEmailAddress: Nullable<string>;
[Column('CREATED_AT_DATETIME', [TColumnProp.Required, TColumnProp.NoUpdate])]
FCreatedAtDateTime: TDateTime;
public
property Id: string read FId; //write FId;
property FirstName: string read FFirstName write FFirstName;
property LastName: string read FLastName write FLastName;
property Mobile: Nullable<string> read FMobile write FMobile;
property Landline: Nullable<string> read FLandline write FLandline;
property EmailAddress: Nullable<string> read FEmailAddress write FEmailAddress;
property CreatedAtDateTime: TDateTime read FCreatedAtDateTime; // write FCreatedAtDateTime;
end;
implementation
initialization
RegisterEntity(TParty);
end.