1
エンティティ・フレームワークが次のモデルのジョイン・テーブルを作成していない理由を誰かが教えてくれれば幸いです。これは、型と機能のテーブルを作成していますが、それらを結合するテーブルは作成しません。エンティティ・フレームワークがジョイン・テーブルを作成していない
public class DeviceType
{
[Display(Name = "ID")]
public int DeviceTypeID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public IEnumerable<DeviceFeature> DeviceFeatures { get; set; }
}
public class DeviceFeature
{
[Display(Name = "ID")]
public int DeviceFeatureID { get; set; }
[Required]
public string Name { get; set; }
public string Description { get; set; }
public IEnumerable<DeviceType> DeviceTypes { get; set; }
}
public class DeviceFeatureView
{
public virtual IEnumerable<DeviceType> DeviceTypes { get; set; }
public virtual IEnumerable<DeviceFeature> DeviceFeatures { get; set;
}
両方のエンティティクラスで 'IEnumerable 'を' ICollection 'に変更します。 'ICollection 'は、EFコレクションのナビゲーションプロパティのための最小要件です。 –