Adapter - Sub Type on joined value

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 19-Mar-2008 20:24:14   

In the designer, we have the following tables (not really, but this simplifies it):

Employee, joins to Department.

Department has the field "IsManagement" (yah yah silly)

How do we create a Sub Type called Manager in the designer based on if the IsManagement" is true and the fields all come from Employee.

Basically the discriminator is in another table.

Ian

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 20-Mar-2008 04:36:25   

This isn't possible as as see. The designer not allow that too. As the discriminator is in another entity, nothing guarantee that the related entity will be prefetched, and if it wouldn't prefetched the type of the entity would be unknown.

I workaround could be create a hierarchy in DepartamentEntity. So when you prefetch a Employee.Departament you will know the type of Departament (DepSubA, DepSubB, etc.).

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 20-Mar-2008 10:09:44   

LLBLGen Pro uses discriminator values for type specification, not expressions. So boolean flags aren't really useful, as you can just create 2 types, which is rather fragile, as you might want to change the flag to false if it's true at one given point and the type changes.

Frans Bouma | Lead developer LLBLGen Pro