title: A dependent property in a ReferentialConstraint is mapped to a store-generated column
body: <p>I get this error when writing to the database:</p>
  
  <blockquote>
    <p>A dependent property in a ReferentialConstraint is mapped to a
    store-generated column. Column: 'PaymentId'.</p>
  </blockquote>
  
  <pre><code>public bool PayForItem(int terminalId, double paymentAmount, 
        eNums.MasterCategoryEnum  mastercategoryEnum, int CategoryId, int CategoryItemId)
      {
  
          using (var dbEntities = new DatabaseAccess.Schema.EntityModel())
          {
              int pinnumber = 0;
              long pinid = 1; //getPinId(terminalId,ref pinnumber) ;
              var payment = new DatabaseAccess.Schema.Payment();
              payment.CategoryId = CategoryId;
              payment.ItemCategoryId = CategoryItemId;
              payment.PaymentAmount = (decimal)paymentAmount;
              payment.TerminalId = terminalId;
              payment.PinId = pinid;
  
              payment.HSBCResponseCode = "";
              payment.DateActivated = DateTime.Now;
              payment.PaymentString = "Payment";
              payment.PromotionalOfferId = 1;
              payment.PaymentStatusId = (int)eNums.PaymentStatus.Paid;
  
              //payment.PaymentId = 1;
  
              dbEntities.AddToPayments(payment);
              dbEntities.SaveChanges();
          }
          return true;
      }
  </code></pre>
  
  <p>The schema is:</p>
  
  <p><img src="https://i.stack.imgur.com/ygkYW.png" alt="enter image description here"></p>