Controller 용 Scaffold를 만들고 Model 클래스를 추가하면 "유형 당 여러 객체 세트가 지원되지 않습니다."오류가 발생합니다.형식 당 여러 개체 집합이 지원되지 않습니다?
1.Department.CS
2.Designation.cs
3.CompanyDBContext.cs
데이터베이스
:내가 세 가지 모델 클래스가 나는 데이터베이스에 두 개의 테이블이, 1. 부서 (deptID, 부서 이름, 설명) 2. 지정 (desgtID, 이름, 설명)
목표 : -이 sce에 대한 하나의보기 페이지를 만들고 싶습니다. 노리오. 이처럼
양식 (텍스트 상자) + 부서 이름 (드롭 다운 목록 상자) + 지정 이름 (드롭 다운 목록 상자)의삽입 이름
1.Department.CS
namespace mvcAppraisalSystem.Models
{
public class Department
{
[Key]
public int deptID { get; set; }
public string deptName { get; set; }
public string Description { get; set; }
}
}
2.Designation.cs
namespace mvcAppraisalSystem.Models
{
public class Designation
{
[Key]
public int desgID { get; set; }
public string desgName { get; set; }
public string description { get; set; }
}
}
3.CompanyDBContext.cs
namespace mvcAppraisalSystem.Models
{
public class CompanyDBContext : DbContext
{
public CompanyDBContext() : base("CompanyDBContext")
{
}
public DbSet<CompanyDBContext> Departments { get; set; }
public DbSet<CompanyDBContext> Designations { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
}
}
}
오케이, 당신의 요지를 얻었습니다. 내 목표는, 두 모델 클래스에 대한 하나의보기 페이지를 만들고 싶습니다. 내가 말했듯이 내 머니? –
두 가지 질문을하고 있습니다. 게시 한 오류는이 대답에서 지적한 문제 때문입니다. –
예, 당신은 완전히 라이트입니다. 도와 줘서 고마워하지만 내 질문의 객관성에서 언급 한 나의 완전한 질문에 대한 도움을 원합니다. –