C.10. Relationships

If an element that is inferred as a table has a child element that is also inferred as a table, a DataRelation will be created between the two tables. A new column with a name of “ParentTableName_Id” will be added to both the table created for the parent element, and the table created for the child element. The ColumnMapping property of this identity column will be set to MappingType.Hidden. The column will be an auto-incrementing primary key for the parent table, and will be used for the DataRelation between the two tables. The data type of the added identity column will be System.Int32, unlike the data type of all other inferred columns, which is System.String. A ForeignKeyConstraint with DeleteRule = Cascade will also be ...

Get Essential ADO.NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.