Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I understand your schema correctly, you have an <code>Address</code> table with a discriminator column, <code>addressTypeID</code>, which defines which kind of <em>Address</em> that particular record represents. The single <code>Address</code> table contains both types of records...<strong>Billing</strong> and <strong>Shipping</strong> addresses. If this is the case, then you actually have a Table-Per-Hierarchy, or TPH, structure, since there is <em>one table per class hierarchy</em>.</p> <p>You mentioned that you thought you had a Table-Per-Concrete-type, or TPC, structure. If that were the case, then your database would require both <code>ShippingAddress</code> and <code>BillingAddress</code> tables, since in TPC, there is <em>one table per concrete type</em>.</p> <p>You would need to have a code structure similar to the following:</p> <pre><code>public abstract class Address { // Common address properties } public class ShippingAddress: Address { // Additional shipping-address specific properties } public class BillingAddress: Address { // Additional billing-address specific properties } </code></pre> <p>You would then need to map your class hierarchy of <code>ShippingAddress</code> and <code>BillingAddress</code> types as a TPH mapping on your single <code>Address</code> table, discriminated on the <code>addressTypeID</code> column. The AddressType column would not even play a role in the mapping, unless you wished to map by some AddressType name or surrogate key. In that case, a view that presents a merged view of the appropriate Address and AddressType tables would be your base TPH schema source, with the discriminator column being the surrogate key column included from the AddressType table.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload