首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PLINQO主键和索引问题

PLINQO主键和索引问题
EN

Stack Overflow用户
提问于 2010-08-24 04:22:50
回答 1查看 303关注 0票数 0

我有两个表,Profile和ProfileCategory

代码语言:javascript
复制
ProfileId INT IX
UserId UNIQUEIDENTIFIER PK (For one-to-one mapping with aspnet_membership)
CompanyName
Description

ProfileCategory
CategoryId
ProfileId

当我使用PLINGO生成代码时,我得到以下错误

运算符“==”不能应用于“int?”类型的操作数。and 'System.Guid‘运算符'==’不能应用于'int?‘类型的操作数。和'System.Guid‘

我深入研究了生成的代码和以下内容。

代码语言:javascript
复制
    [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);
    }

因此,生成的代码似乎想要比较索引和主键

我可以手动修改代码,但在重新生成时,它将被修改回来。

有人知道为什么会这样吗?

谢谢

下面是dbml文件中的配置文件片段

代码语言:javascript
复制
    <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>

EN

回答 1

Stack Overflow用户

发布于 2010-08-24 07:43:32

你有没有检查过这个问题是否已经在PLINQO的夜间构建中得到了修复?您可以发布这两个表的模式(或发送给CodeSmith支持)吗?

谢谢-Blake Niemyjski

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3551367

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档