1

我的应用程序首先使用 EF3.5 开始开发,并将 Model/EDMX 升级到 EF5。我正在尝试使用返回 2 个结果集的存储过程。这两个结果都是查询的结果,并且没有任何具有精确列顺序的表。

我已经按照Microsoft 文章的第二部分进行了编译。但是在运行时它会引发错误

错误 3027:未为以下 EntitySet/AssociationSet - NotViewedReports、ViewedReports 指定映射

如何使这项工作?任何帮助是极大的赞赏

这是此存储过程的整个映射

<EntityType Name="NotViewedReport">
          <Key>
            <PropertyRef Name="RecordID" />
          </Key>
          <Property Name="RecordID" Type="String" Nullable="false" MaxLength="240" FixedLength="false" Unicode="true" />
          <Property Name="ReportId" Type="Int32" Nullable="true" />
          <Property Name="ReportDesc" Type="String" Nullable="true" MaxLength="240" FixedLength="false" Unicode="true" />
          <Property Name="ReportLink" Type="String" Nullable="true" MaxLength="240" FixedLength="false" Unicode="true" />
          <Property Name="ReportDate" Type="DateTime" Nullable="true" Precision="3" />
          <Property Name="DistributionDate" Type="DateTime" Nullable="true" Precision="3" />
          <Property Name="ReportTypeId" Type="Int32" Nullable="true" />
          <Property Name="IsLocked" Type="Boolean" Nullable="true" />
          <Property Name="EffectiveStartDate" Type="DateTime" Nullable="true" Precision="3" />
          <Property Name="EffectiveEndDate" Type="DateTime" Nullable="true" Precision="3" />
          <Property Name="Investor_ID" Type="Int32" Nullable="true" />
          <Property Name="Investor_Name" Type="String" Nullable="true" MaxLength="100" FixedLength="false" Unicode="true" />
        </EntityType>
        <EntityType Name="ViewedReport">
          <Key>
            <PropertyRef Name="RecordID" />
          </Key>
          <Property Name="RecordID" Type="String" Nullable="false" MaxLength="240" FixedLength="false" Unicode="true" />
          <Property Name="ReportId" Type="Int32" Nullable="true" />
          <Property Name="ReportDesc" Type="String" Nullable="true" MaxLength="240" FixedLength="false" Unicode="true" />
          <Property Name="ReportLink" Type="String" Nullable="true" MaxLength="240" FixedLength="false" Unicode="true" />
          <Property Name="ReportDate" Type="DateTime" Nullable="true" Precision="3" />
          <Property Name="DistributionDate" Type="DateTime" Nullable="true" Precision="3" />
          <Property Name="Mr_Ms" Type="String" Nullable="true" MaxLength="50" FixedLength="false" Unicode="true" />
          <Property Name="Last_Name" Type="String" Nullable="true" MaxLength="50" FixedLength="false" Unicode="true" />
          <Property Name="First_MI" Type="String" Nullable="true" MaxLength="50" FixedLength="false" Unicode="true" />
          <Property Name="Company" Type="String" Nullable="true" MaxLength="255" FixedLength="false" Unicode="true" />
          <Property Name="LoginTime" Type="DateTime" Nullable="true" Precision="3" />
          <Property Name="Contact_ID" Type="Int32" Nullable="true" />
          <Property Name="LastViewed" Type="DateTime" Nullable="true" Precision="3" />
          <Property Name="Investor_Name" Type="String" Nullable="true" MaxLength="100" FixedLength="false" Unicode="true" />
        </EntityType>
    </Schema>
    </edmx:ConceptualModels>

......
<FunctionImport Name="GetBatchViewStatus">
            <Parameter Name="batchFrom" Mode="In" Type="Int32" />
            <Parameter Name="batchTo" Mode="In" Type="Int32" />
            <ReturnType EntitySet="NotViewedReports" Type="Collection(IRISModel.NotViewedReport)" />
            <ReturnType EntitySet="ViewedReports" Type="Collection(IRISModel.ViewedReport)" />
          </FunctionImport>
        </EntityContainer>

.....
<FunctionImportMapping FunctionImportName="GetBatchViewStatus" FunctionName="IRISModel.Store.GetBatchViewStatus" >
              <ResultMapping>
                <EntityTypeMapping TypeName ="IRISModel.NotViewedReport">
                  <ScalarProperty Name="RecordID" ColumnName="RecordID" />
                  <ScalarProperty Name="ReportId" ColumnName="ReportId" />
                  <ScalarProperty Name="ReportDesc" ColumnName="ReportDesc" />
                  <ScalarProperty Name="ReportLink" ColumnName="ReportLink" />
                  <ScalarProperty Name="ReportDate" ColumnName="ReportDate" />
                  <ScalarProperty Name="DistributionDate" ColumnName="DistributionDate" />
                  <ScalarProperty Name="ReportTypeId" ColumnName="ReportTypeId" />
                  <ScalarProperty Name="IsLocked" ColumnName="IsLocked" />
                  <ScalarProperty Name="EffectiveStartDate" ColumnName="EffectiveStartDate" />
                  <ScalarProperty Name="EffectiveEndDate" ColumnName="EffectiveEndDate" />
                  <ScalarProperty Name="Investor_ID" ColumnName="Investor ID" />
                  <ScalarProperty Name="Investor_Name" ColumnName="Investor Name" />
                </EntityTypeMapping>
              </ResultMapping>
              <ResultMapping>
                <EntityTypeMapping TypeName="IRISModel.ViewedReport">
                  <ScalarProperty Name="RecordID" ColumnName="RecordID" />
                  <ScalarProperty Name="ReportId" ColumnName="ReportId" />
                  <ScalarProperty Name="ReportDesc" ColumnName="ReportDesc" />
                  <ScalarProperty Name="ReportLink" ColumnName="ReportLink" />
                  <ScalarProperty Name="ReportDate" ColumnName="ReportDate" />
                  <ScalarProperty Name="DistributionDate" ColumnName="DistributionDate" />
                  <ScalarProperty Name="Mr_Ms" ColumnName="Mr/Ms" />
                  <ScalarProperty Name="Last_Name" ColumnName="Last Name" />
                  <ScalarProperty Name="First_MI" ColumnName="[First/MI]" />
                  <ScalarProperty Name="Company" ColumnName="Company" />
                  <ScalarProperty Name="LoginTime" ColumnName="LoginTime" />
                  <ScalarProperty Name="Contact_ID" ColumnName="Contact ID" />
                  <ScalarProperty Name="LastViewed" ColumnName="LastViewed" />
                  <ScalarProperty Name="Investor_Name" ColumnName="Investor Name" />
                </EntityTypeMapping>
            </ResultMapping>
          </FunctionImportMapping>            
          </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
4

0 回答 0