2011-05-12 3 views
1

왜 내가 갑자기 이러한 컴파일 오류를 알아낼 수 없습니다. 의 내가 가지고 단계를 가자 : 내 모델 폴더에서 면도기보기 엔진ADO.NET 자체 추적 엔티티 생성기가 오류를 컴파일

2)를 사용하여)

1) 나는 새로운 MVC3 ASP.NET 프로젝트 (C 번호를 생성, 나는 ADO.NET 엔터티 데이터를 추가 모델, 데이터베이스에 연결하고 이름을 Database.edmx로 변경하십시오.

3) Database.edmx를 열고 코드 생성 항목 추가를 선택하십시오. 그런 다음 Selft-Tracking Entity Generator를 추가하고 Model.tt이라고합니다.

모든 것이 자동으로 생성됩니다. 나는 그러나 구축 칠 때, 나는 컴파일 오류가 다음 얻을 :

나에게
Error 1 Cannot implicitly convert type 'System.Type' to 'MyOwnProject.Models.Type' 
Error 2 'MyOwnProject.Models.Type' does not contain a definition for 'IsValueType' and no extension method 'IsValueType' accepting a first argument of type 'MyOwnProject.Models.Type' could be found (are you missing a using directive or an assembly reference?) 
Error 3 'MyOwnProject.Models.Type' does not contain a definition for 'IsGenericType' and no extension method 'IsGenericType' accepting a first argument of type 'MyOwnProject.Models.Type' could be found (are you missing a using directive or an assembly reference?) 
Error 4 'MyOwnProject.Models.Type' does not contain a definition for 'GetGenericTypeDefinition' and no extension method 'GetGenericTypeDefinition' accepting a first argument of type 'MyOwnProject.Models.Type' could be found (are you missing a using directive or an assembly reference?) 
Error 5 Cannot implicitly convert type 'System.Type' to 'MyOwnProject.Models.Type' 
Error 6 'MyOwnProject.Models.Type' does not contain a definition for 'FullName' and no extension method 'FullName' accepting a first argument of type 'MyOwnProject.Models.Type' could be found (are you missing a using directive or an assembly reference?) 
Error 7 'MyOwnProject.Models.Type' does not contain a definition for 'FullName' and no extension method 'FullName' accepting a first argument of type 'MyOwnProject.Models.Type' could be found (are you missing a using directive or an assembly reference?) 

, 이것은 전혀 의미가 없습니다. 데이터베이스를 가지고 새로운 프로젝트를 12 번이나 만들었습니다. 갑자기이 컴파일 오류가 발생합니다. 나는 데이터베이스, edmx 또는 모델의 이름을 바꾸지 않습니다. 또한 데이터베이스가 App_Data 폴더 또는 하드 드라이브의 외부 위치에 있어야한다는 점에서 차이가 없습니다.

왜 이것이 실패하고 있는지 알 수있는 사람이 있습니까? 감사.

답변

2

데이터베이스에 테이블 TYPES이있는 것처럼 보입니다. 엔티티 클래스는 Type입니다. 이 클래스는 클래스 System.Type을 숨 깁니다. 엔티티의 이름을 다른 이름으로 변경하십시오 (예 : TypeEntity.

+0

사실, 내 데이터베이스에 테이블 유형이 있습니다 ... 생각하지 않았습니다. 감사! – Matthias

+0

"EntityType"이라는 테이블에 동일한 문제가 발생하여 문제가 발생했습니다. DataModel.Context.tt 파일의 "EntityType"에 대한 각 설명을 수정하여 대신 "System.Data.Metadata.Edm.EntityType"이되도록 수정했습니다. –

2

엔티티 "유형"이라고하지 마십시오. 이 실제로 매우 중요합니다.은 .NET에서 이미 Type이라고 불립니다. 당신은이 이름으로 고통을 겪을 것입니다. 내장형 기본 유형 이름과 다른 이름을 선택하십시오.

+0

예, 물론 ... 그것에 대해 생각하지 않았습니다. 고맙습니다. – Matthias

관련 문제