1
Visual Studio 2015 미리보기에서 웹 응용 프로그램을 만들려고합니다. 커맨드 라인 스캐 폴딩을 사용하여 뷰를 생성하려고합니다. 나는 다음과 같은 명령을 사용 :asp.Net에서 명령 줄 스캐 폴딩 VNext
k gen controller -name ProductController -m ViewModels.Product -dc ProductContext -f -udl
ViewModels.Product
클래스가 다른 프로젝트에 정의 UI 프로젝트에서 참조됩니다. 명령을 실행하는 동안 나는 다음과 같은 오류가 발생합니다 :
Finding the generator 'controller'...
Running the generator 'controller'...
Attempting to figure out the EntityFramework metadata for the model and DbContext.
The entity type 'ViewModels.Product' requires a key to be defined.
Product
클래스에서 내가 System.ComponentModel.DataAnnotations
에 대한 참조를 추가하고 [key]
속성을 가진 속성을 정의했습니다. 뷰가 아닌 DataContext 클래스를 만듭니다.
누구든지 제게 잘못 생각해주십시오.