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 컬렉션 탐색 속성의 최소 요구 사항입니다. –