OK、この構成で、OrderPage とその子 OrderPageShipDate インスタンスのコレクションとの間の識別関係を設定しています。
public class OrderPageShipDateConfiguration : EntityTypeConfiguration<OrderPageShipDate>
{
public OrderPageShipDateConfiguration()
{
this.HasKey(t => new { t.OrderPageId, t.Id });
this.Property(p => p.OrderPageId).HasColumnOrder(1);
this.Property(p => p.Id).HasColumnOrder(2)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
this.HasRequired(opi => opi.OrderPage)
.WithMany(op => op.ShipDates)
.HasForeignKey(opi => opi.OrderPageId);
}
これらの参加者と:
/// <summary>
/// This class represents a a set of items added to an order from a particular bulletin at a particular time.
/// </summary>
public class OrderPage : IEntity, IAuditInfo
{
#region Construction
//...
#endregion
public int Id { get; set; }
// other properties...
public virtual ICollection<OrderPageShipDate> ShipDates { get; set; }
}
_
/// <summary>
/// This class represents a shipping date for an order page that has been added to an order.
/// </summary>
public class OrderPageShipDate : IEntity
{
#region Construction
// ...
#endregion
public int Id { get; set; }
public int OrderPageId { get; set; }
public virtual OrderPage OrderPage { get; set; }
public DateTime ShipDate { get; set; }
}
OrderPageShipDate テーブルの Id 列に設定された ID 仕様を取得できません。
理由はありますか?
これらのクラスが実装する IEntity インターフェイスで指定されている Id プロパティと何か関係があるのでしょうか?
ここにあるように、データ注釈アプローチと Fluent API アプローチの両方を試しました。