KastroNYC wrote:
That's actually almost identical to the setup i've been trying make work my question is this, lets say i have another table(entity) called Posting which has a FK to ProviderID how can I tell what type of Provider this Posting is refering to so if I want to display the provider details when the Posting is clicked on.
I'm not sure the question really got answered and I'm actually heading down this road and have been pondering the exact same thing so I'll try to re-phrase with a little more detail.
Using Otis' example of a library with items that can be derived into Books, Magazines, etc. we have the following table model:
Item
ItemID INT [PK]
Title
Description
Book
BookID INT [PK, FK]
Author
Publisher
Magazine
MagazineID INT [PK, FK]
MonthPublished
SubscriptionEndDate
I understand how I would want to use LLBLGen Pro to create a hierarchy of type TargetPerEntity. However, say I want to query all the items in the library that have 'LLBL' in the Title. My query would obviously be targeted at the Title column in the Item table and it would obviously be pretty easy to get a list of results with ItemID and Title.
The two scenarios that I foresee are:
- I want to give each item in the list a different icon based on the type of item it is (book, magazine, etc.) so I would need to know what the item 'type' is.
- When the user clicks on the link for a chosen item, we're obviously just passing the ItemID in the querystring but we would also then need to know if we are going to show a book or a magazine.
To solve both problems and Kas' question, would you have a field on the Item table that tells you what 'Type' (book, magazine) the particular item is? Or is there something baked into LLBL that would automagically tell me whether or not the item derives into a book or magazine?
I haven't actually worked with the table inheritance yet in code and am kind of trying to piece things together based on the doco and various threads I've read.
Any clarification is appreciated.
Thanks,
Matt