I am somewhat uncertain - for ManyValueAssocation list, whose responsibility to free it? In the example of the following code, FUserRole: TList<TUserRole>
, should we free it in the entity's destructor?
[Entity, Automapping]
[Aurelius.Mapping.Attributes.Model(SecurityModel)]
[Table('USERS')]
[UniqueKey('USER_NAME')]
TUser = class
private
FId: Integer;
FUserName: string;
FPassword: string;
[ManyValuedAssociation([], CascadeTypeAllRemoveOrphan, 'FUser')]
[ForeignJoinColumn('USER_ID', [TColumnProp.Required])]
FUserRoles: TList<TUserRole>; // Question: Do we need to free this list in destructor?
FCreateOn: TDateTime;
FDescription: Nullable<string>;
public
constructor Create;
destructor Destroy; override;
property Id: Integer read FId write FId;
property UserName: string read FUserName write FUserName;
property Password: string read FPassword write FPassword;
property UserRoles: TList<TUserRole> read FUserRoles write FUserRoles;
property CreateOn: TDateTime read FCreateOn;
property Description: Nullable<string> read FDescription write FDescription;
end;