2010-08-23 3 views
0
내가 PLINGO으로 코드를 생성 할 때 나는

PLINQO 기본 키와 인덱스 문제

ProfileId INT IX 
UserId UNIQUEIDENTIFIER PK (For one-to-one mapping with aspnet_membership) 
CompanyName 
Description 

ProfileCategory 
CategoryId 
ProfileId 

나는 다음과 같은 오류가

을 두 개의 테이블, 프로필 및 ProfileCategory을받을 것

연산자 '=='는 피연산자에 적용 할 수 없습니다

'int?'유형의 및 'System.Guid' 연산자 '=='은 'int'유형의 피연산자에 적용 할 수 없습니다. 및

[System.Diagnostics.DebuggerNonUserCode] 
    [System.CodeDom.Compiler.GeneratedCode("CodeSmith", "5.0.0.0")] 
    private void OnProfileList1Remove(Profile entity) 
    { 
     SendPropertyChanging(null); 
     var profileCategory = ProfileCategoryList.FirstOrDefault(c => c.CategoryId == CategoryId 
      && c.ProfileId == entity.UserId); 
     ProfileCategoryList.Remove(profileCategory); 
     SendPropertyChanged(null); 
    } 

그래서 생성 된 코드는 내가 직접 할 수있는 인덱스 및 기본 키

을 비교하려는 것 같다 ..

내가 생성 된 코드로 뛰어 다음과 같은 '는 System.Guid' 코드를 변경하지만 중생에 따라 코드가 변경됩니다.

왜 이런 일이 일어나는 지 알고 계십니까?

덕분에 여기

<Table Name="dbo.Profile" Member="Profile"> 
     <Type Name="Profile"> 
      <Column Name="UserId" Storage="_userId" Type="System.Guid" DbType="uniqueidentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" /> 
      <Column Name="ProfileId" Storage="_profileId" Type="System.Int32" DbType="int NOT NULL IDENTITY" CanBeNull="false" /> 
      <Column Name="CompanyName" Storage="_companyName" Type="System.String" DbType="nvarchar(250) NOT NULL" CanBeNull="false" /> 
      <Column Name="Description" Storage="_description" Type="System.String" DbType="varchar(MAX)" CanBeNull="true" /> 
      <Column Name="Services" Storage="_services" Type="System.Xml.Linq.XElement" DbType="xml" CanBeNull="true" UpdateCheck="Never" /> 
      <Column Name="ContactDetails" Storage="_contactDetails" Type="System.Xml.Linq.XElement" DbType="xml" CanBeNull="true" UpdateCheck="Never" /> 
      <Column Name="Attributes" Storage="_attributes" Type="System.Xml.Linq.XElement" DbType="xml" CanBeNull="true" UpdateCheck="Never" /> 
      <Column Name="StateId" Storage="_stateId" Type="System.Int32" DbType="int NOT NULL" CanBeNull="false" /> 
      <Column Name="Views" Storage="_views" Type="System.Int32" DbType="int NOT NULL" CanBeNull="false" /> 
      <Association Name="User_Profile" Member="User" Storage="_user" ThisKey="UserId" Type="User" IsForeignKey="true" DeleteRule="CASCADE" /> 
      <Association Name="Profile_ProfileAddress" Member="ProfileAddressList" Storage="_profileAddressList" OtherKey="UserId" Type="ProfileAddress" DeleteOnNull="false" /> 
      <Association Name="Profile_Review" Member="ReviewList" Storage="_reviewList" ThisKey="ProfileId" OtherKey="ProfileId" Type="Review" DeleteOnNull="false" /> 
      <Association Name="Profile_ProfileCategory" Member="ProfileCategoryList" Storage="_profileCategoryList" ThisKey="ProfileId" OtherKey="ProfileId" Type="ProfileCategory" /> 
     </Type> 
</Table> 
<Table Name="dbo.ProfileCategory" Member="ProfileCategory"> 
    <Type Name="ProfileCategory"> 
     <Column Name="ProfileCategoryId" Storage="_profileCategoryId" Type="System.Int32" DbType="int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> 
     <Column Name="ProfileId" Storage="_profileId" Type="System.Int32" DbType="int" CanBeNull="true" /> 
     <Column Name="CategoryId" Storage="_categoryId" Type="System.Int32" DbType="int NOT NULL" CanBeNull="false" /> 
     <Association Name="Category_ProfileCategory" Member="Category" Storage="_category" ThisKey="CategoryId" Type="Category" IsForeignKey="true" /> 
     <Association Name="Profile_ProfileCategory" Member="Profile" Storage="_profile" ThisKey="ProfileId" OtherKey="ProfileId" Type="Profile" IsForeignKey="true" DeleteRule="CASCADE" /> 
    </Type> 
    </Table> 

alt text

+0

당신이 외래 키 ProfileCategory.ProfileId이 Profile.ProfileId를 참조 있는지 확인해 봤어? – StuartLC

+0

예. 나는 dbml 파일을 체크하고 데이터베이스에서 외래 키 관계를 삭제하고 다시 만들었다. – Mantisimo

답변

0

당신이 이미 PLINQO의 야간 빌드에서 수정되지 않았습니다 확인하기 위해 확인 했 DBML에서 프로파일 snipet입니까? 이 두 테이블에 대해 스키마를 게시하거나 CodeSmith 지원부에 보내주십시오.

감사 -Blake Niemyjski

+0

그냥이 일을하고 그것은 작동하지 않았다. 내 현재 프로젝트를 통해 이것을 실행 해봤는데 실패했을 때도 새 프로젝트를 생성했습니다. 나는 Entity.Generated.cst를 보았고 그것은 많은 PKO와 IX를 많은 관계로 혼란스럽게 보입니다. – Mantisimo

+0

위 스키마를 추가하겠습니다. 감사합니다 – Mantisimo

+0

안녕하세요, 스키마를 추가 할 수있는 곳은 어디입니까? 감사합니다. -Blake Niemyjski –