Entity subtypes

Posts   
 
    
Posts: 2
Joined: 19-Sep-2006
# Posted on: 19-Sep-2006 12:34:17   

Hi,

I've got a database table (AgentTask) with 3 columns:

agentId (FK to Agent table) numberOfHouses housesType

where: - numberOfHouses is a (possibly negative) integer, - housesType is related to lookup table

This works as follows: if numberOfHouses > 0 then the entry is treated as a taskAssigned if numberOfHouses < 0 then the entry is treated as taskSolved

Question: I'm using adapter model, is there anyway I could breakdown AgentActivity entity so that given an agent I can easy access taskAssigned (or taskSolved)? Or perhaps I could also take into account housesType column and have entity taskAssignedSemiDetached ?

In SQL this would look like that:

select * from AgentTask where where agentID = @agentID and numberOfHouses > 0 and housesType = 2 /* for semi detached */

I'm a LLBLGen newbie, so speak slowly, please simple_smile

Thanks, Piotr

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 19-Sep-2006 15:57:31   

Hi, I don't think you can set TargetPerEntityHierarchies with a relative discrminator value. The discrinator values have to be enumerated.

But then, Why not having specific filter factories, and methods that ease fetching or filtering an exiting collection according to your clauses.

I think it's not much overhead, and you can make it clear by naming your variable accordingly to the filters you apply.

Cheers

Posts: 2
Joined: 19-Sep-2006
# Posted on: 19-Sep-2006 17:28:12   

Jesse,

Could you give me an example how this could be done quickly hassel-free?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 20-Sep-2006 10:51:05   

I think what Jessynoo meant was that the numofhouses value could be used as an enumerator, but as you describe it, you can't use the value as a type discriminator value, because the discriminator value is stored in the code you're using. I.o.w.: it's not dynamic: data in the db can't change type by storing a different value in a row, or at least, it shouldn't.

Frans Bouma | Lead developer LLBLGen Pro