Figuring out how subtypes and discriminators work

Posts   
 
    
Posts: 20
Joined: 02-Oct-2006
# Posted on: 15-Jan-2007 18:55:41   

I have a Northwind database and I would like to make a subtype/supertype relationships on Employees using the ReportsTo (of type int); Specifically make a TopBrass subtype where ReportsTo is Null, or SecondString where ReportsTo equals 2.

but ReportsTo doesn't show in the discriminator field drop down in LLBLGen pro V2.0 after clicking "create subtype for this entity".

So how do I get ReportsTo to show in the discriminator field drop down? (or any field I make... as I have added indexed bit fields and nothing shows in the discriminator field drop down after I refresh the catalog)

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 16-Jan-2007 00:55:44   

I would think that the discriminator column needs to not allow null. Can you make TopBrass 0 and not allow nulls?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 17-Jan-2007 00:14:38   

nullable fields and FK fields aren't recommended nor supported as discriminator fields. Discriminator fields are fields which are non-nullable and not an FK, so they stay the same value as long as the entity lives.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 20
Joined: 02-Oct-2006
# Posted on: 17-Jan-2007 16:18:22   

So how do I get Fields to show in the discriminator field drop down for any field I make?

I have added indexed bit fields and nothing shows in the discriminator field drop down after I refresh the catalog. (and it does show as a field in the fields list)

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 17-Jan-2007 16:30:01   

Does this field AllowNull in the database? and/or is it a FK field?w

Posts: 20
Joined: 02-Oct-2006
# Posted on: 17-Jan-2007 16:51:05   

'ReportsTo' is a int FK and allows nulls. (the first attempt I made)

however the field I added in my second attempt is not; I added a 'IsManager' bit field that does not allow nulls, it shows in the fields list but not in the discriminators drop down.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 17-Jan-2007 17:03:09   

Would you try an int field.

Posts: 20
Joined: 02-Oct-2006
# Posted on: 17-Jan-2007 17:48:23   

Ok that works, thanks!

btw manual says bit works

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 17-Jan-2007 19:55:57   

John.T.Gold wrote:

Ok that works, thanks!

btw manual says bit works

Ok, but not a nullable bit simple_smile . If a field is nullable, it's not going to work.

Frans Bouma | Lead developer LLBLGen Pro