Hi,
I have a class User and a class Employer. A User in my application is necessarily an Employee of the company but not the other way around.
I chose to have an association between those classes.
So I have something like :
TEmployee= class(TObject)
[...]
[Association([TAssociationProp.Lazy],)]
[JoinColumn('User_ID')]
FCorrespondingUser: Proxy<TUser>;
Now the thing is when I want to insert an Employee object in my database, and more precisely when i want to set the attribute FCorrespondingUser.
I have something like :
var
Util : TUser;begin
Emp : TEmployee;
Manager : TObjectManager;
Manager := TObjectManageR.Create(AureliusConnection);Here my Util is of type TUser, but the CorrespondingUser field is of type Proxy<TUser>
Util := Manager.Find<TUser>(8);
[...]
Emp.CorrespondingUser := Util;
So i have an incompatible type issue.
What is the best way do deal with this ? Am i just supposed to cast my User to a Proxy<User>?
Thank you in advance,
Antoine