Let's say I have two tables A and B. The relationship between these two tables is as follows :
A (1,*) <---- (1,1) B
Now when I try to add a relationship class for these two tables on Arcatalog, I right-click on the .sde file in Arcatalog and then :
New ==> relationship class.
For the origin table I choose A, and for the destination table I choose B
(Is that right btw or should it be the opposite?)
For the type of the relation ship I select : Simple (Peer to Peer) relationship
Direction : Both
The cardinality of the relationship class : (1 - m) One to Many
And after that I get to select the primary key field in the origin table and the foreign key in the destination table:
As you can see for the foreign key it actually gives me the objectid of that table, now I need to understand if I have to manually add the foreign key field in that table and then select it here?
Shouldn't it be created automatically after the relationship class is created? Obviously when I click on Next and I go back to my postgresql table no foreign key is added.. and it's confusing 'cause I thought that once we define a relationship automatically the id of the origin table migrates to the destination table and becomes a foreign key!
I had to use this database in a web application using ASP.NET, with Entity Framework, and I got confused after Entity Framework has generated the model from my database (at first I added the FK manually).. So now I'm doing it all over again and I would like to do it the right way..
How can I define the foreign keys and the relationship classes from arcatalog?