Code-first and generation client unit _intf.pas

Hi,

I’m developing a new application and I use code-first. I have a Login Service and I defined a new unit with the RODLTyped. In this unit I create a class derived from the class UserInfo.

Server side it’s all ok. Client side when I generate the _intf interface unit my custom UserInfo class has only the based type properties.

Server side:

  TUserInfoEx = class(UserInfo)
  private
    FPKUser: Integer;
    FFirstName: UnicodeString;
    FLastName: UnicodeString;
    FFiscalCode: UnicodeString;
    FIsAdmin: Boolean;
    FIsSuperUser: Boolean;
    FIsInternal: Boolean;
    FDatePasswordExpiration: DateTime;
    FDateLastChengedPassword: DateTime;
    FChangePassword: Boolean;
    FResetPassword: Boolean;
    FEmail: UnicodeString;
    FRequiredPIN: Boolean;
    FRegistrationNumber: UnicodeString;
    FVocalProfile: UnicodeString;
    FAllowOverbooking: Boolean;
    FWards: TUserWardArray;
    FSelectedWardIndex: Integer;
    function GetWards: TUserWardArray;
  public
    procedure BeforeDestruction; override;
  published
    property PKUser: Integer read FPKUser write FPKUser;
    property FirstName: UnicodeString read FFirstName write FFirstName;
    property LastName: UnicodeString read FLastName write FLastName;
    property FiscalCode: UnicodeString read FFiscalCode write FFiscalCode;
    property IsAdmin: Boolean read FIsAdmin write FIsAdmin;
    property IsSuperUser: Boolean read FIsSuperUser write FIsSuperUser;
    property IsInternal: Boolean read FIsInternal write FIsInternal;
    property DatePasswordExpiration: DateTime read FDatePasswordExpiration write FDatePasswordExpiration;
    property DateLastChengedPassword: DateTime read FDateLastChengedPassword write FDateLastChengedPassword;
    property ChangePassword: Boolean read FChangePassword write FChangePassword;
    property ResetPassword: Boolean read FResetPassword write FResetPassword;
    property Email: UnicodeString read FEmail write FEmail;
    property RequiredPIN: Boolean read FRequiredPIN write FRequiredPIN;
    property RegistrationNumber: UnicodeString read FRegistrationNumber write FRegistrationNumber;
    property VocalProfile: UnicodeString read FVocalProfile write FVocalProfile;
    property AllowOverbooking: Boolean read FAllowOverbooking write FAllowOverbooking;
    //THIS PROPERTY IS IGNORED WHEN I CREATE THE _INTF UNIT ON THE CLIENT
    property Wards: TUserWardArray read GetWards;
    property SelectedWardIndex: Integer read FSelectedWardIndex write FSelectedWardIndex;
  end;

Client side generate _intf;

  TUserInfoEx = class(UserInfo)
  private
    fPKUser: Integer;
    fFirstName: UnicodeString;
    fLastName: UnicodeString;
    fFiscalCode: UnicodeString;
    fIsAdmin: Boolean;
    fIsSuperUser: Boolean;
    fIsInternal: Boolean;
    fDatePasswordExpiration: DateTime;
    fDateLastChengedPassword: DateTime;
    fChangePassword: Boolean;
    fResetPassword: Boolean;
    fEmail: UnicodeString;
    fRequiredPIN: Boolean;
    fRegistrationNumber: UnicodeString;
    fVocalProfile: UnicodeString;
    fAllowOverbooking: Boolean;
    fSelectedWardIndex: Integer;
  public
    procedure Assign(aSource: TPersistent); override;
    procedure ReadComplex(aSerializer: TObject); override;
    procedure WriteComplex(aSerializer: TObject); override;
  published
    property PKUser: Integer read fPKUser write fPKUser;
    property FirstName: UnicodeString read fFirstName write fFirstName;
    property LastName: UnicodeString read fLastName write fLastName;
    property FiscalCode: UnicodeString read fFiscalCode write fFiscalCode;
    property IsAdmin: Boolean read fIsAdmin write fIsAdmin;
    property IsSuperUser: Boolean read fIsSuperUser write fIsSuperUser;
    property IsInternal: Boolean read fIsInternal write fIsInternal;
    property DatePasswordExpiration: DateTime read fDatePasswordExpiration write fDatePasswordExpiration;
    property DateLastChengedPassword: DateTime read fDateLastChengedPassword write fDateLastChengedPassword;
    property ChangePassword: Boolean read fChangePassword write fChangePassword;
    property ResetPassword: Boolean read fResetPassword write fResetPassword;
    property Email: UnicodeString read fEmail write fEmail;
    property RequiredPIN: Boolean read fRequiredPIN write fRequiredPIN;
    property RegistrationNumber: UnicodeString read fRegistrationNumber write fRegistrationNumber;
    property VocalProfile: UnicodeString read fVocalProfile write fVocalProfile;
    property AllowOverbooking: Boolean read fAllowOverbooking write fAllowOverbooking;
    property SelectedWardIndex: Integer read fSelectedWardIndex write fSelectedWardIndex;
  end;

The property Wards not exist on the client, is ignored

In the server I defined this

  TWard = class(TROComplexType)
  private
    FWardCode: Integer;
    FWardName: UnicodeString;
    FWardType: TWardType;
    FDefault: Boolean;
  published
    property WardCode: Integer read FWardCode write FWardCode;
    property WardName: UnicodeString read FWardName write FWardName;
    property WardType: TWardType read FWardType write FWardType;
    property IsDefault: Boolean read FDefault write FDefault;
  end;

  TWardCollection = class(TROCollection< TWard >);
  
  TUserWardArray = class(TROArray< TWard >);

I can’t understand why the Wards property (of type TUserWardArray) defined in the TUserInfoEx class is ignored

Thank you very much!

Best Regards

Hi,

you should declare your property as read/write.
all read/only properties are ignored

1 Like

Hi EvgenyK

thank you very much for your support! Yes the problem was the read only proprerty!!!