Convert Entity to Inherited Entity

Posts   
 
    
jbb avatar
jbb
User
Posts: 267
Joined: 29-Nov-2005
# Posted on: 02-Jul-2013 12:17:17   

Hello,

I'm using LLBL 2.6/ Adapter scenario and got a question on an inheritance problem. To be simple, I have an EmployeeEntity and a ManagerEntity, Manager inherits employee (IDEmployee is a PK/FK fot the Manager table). The code was generated using the 'Construct Target per Entity Hierarchies'. I need to convert an Employee to a Manager and save the new entity.

I cannot delete the employeeEntity and recreate a ManagerEntity because I have some data linked to the employee. Is there a way to just convert the entity to one of its inherited entity?

Regards,

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Jul-2013 07:52:44   

Hi jbb,

You can't promote/demote between inheritance types. This is a discussion about the reason: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=14835

If you need to do that, maybe you have to re-evaluate whether or not you really need inheritance here. You could code a workaround (like map another copy of ManagerCopyEntity that is not part of inheritance, so you can save it separately), but IMHO this could lead to data errors in the future.

David Elizondo | LLBLGen Support Team
jbb avatar
jbb
User
Posts: 267
Joined: 29-Nov-2005
# Posted on: 03-Jul-2013 09:14:56   

Hi,

thanks for your answer, I created a new entity in the designer which is not part of the inheritance and it works.

Regards,

Jb