This project is read-only.

Use of ParentTables

Nov 6, 2009 at 7:47 PM

Is there a tutorial on this feature - I cannot seem to get it to work - I get errors relating to IDs and fields - the three example tables that I am trying to use are as follows


PersonID (int)
Forename (nvarchar(50))
Surname (nvarchar(50))


BrokerID (int)
PersonID (int)
Sponsor (int)
TradingName (nvarchar(50))


TraderID (int)
PersonID (int)
Sponsor (int)
PersonalEmailAddress (nvarchar(255))

A Broker is related to a person and a Trader is related to a person - common data is held in the person table

My understanding of the docs regarding inheritance would be that using the ParentTable, the Broker would pull in the fields from the Person table and equally the Trader would pull in the fields from the Person table - using their relationships - is my understanding correct - so composite entities are formed

When I run the generator I get odd messages about fields needing to match and be named the same

Any help gratefully accepted

Nov 6, 2009 at 8:24 PM
Edited Nov 6, 2009 at 8:24 PM

There are a couple of things here. First you do not need a PersonID and BrokerId. You have a PersonID in both table. It is the primary key in both tables. You define a relationship from Person to Broken on this PK. The Broker table must have its ParentTable set to Person. Now when you generate the Border object will have its own propertie as well as the properties inherited from Person object. If you still have an error after this, please post the validation error the generator gives you.

If the PersonID field in the Person table is an Identity (I assume it is) it should not be an identity in the child tables. There is validation for this to tell you, but I wanted to warn you anyway. This is because the ID is autogenerated for Person and the generator will push the key into the Broker table (or Trader of course). You cannot have 2 identites because remmeber this is really the "same" object. A Broker is a Person, a Trader is a person. That is why you do not need an extra BrokerId or TraderID. The PersonID is the unique identifier.

Dec 4, 2009 at 3:15 AM

There is a training video on YouTube at the following URL.