C# Entityset映射错误-EF5-具有多个结果集的存储过程

C# Entityset映射错误-EF5-具有多个结果集的存储过程,c#,entity-framework,stored-procedures,entity-framework-5,C#,Entity Framework,Stored Procedures,Entity Framework 5,我的应用程序最初是用EF3.5开发的,并将Model/EDMX升级为EF5。我试图使用一个返回2个结果集的存储过程。这两个结果都是查询的结果,没有任何具有精确列顺序的表 我遵循了第二部分,并进行了编译。但是,在运行时它会抛出一个错误 错误3027:未为以下项指定映射 EntitySet/AssociationSet-NotViewedReports,ViewedReports 我们如何才能做到这一点?非常感谢您的帮助 以下是此存储过程的完整映射 <EntityType Name="NotV

我的应用程序最初是用EF3.5开发的,并将Model/EDMX升级为EF5。我试图使用一个返回2个结果集的存储过程。这两个结果都是查询的结果,没有任何具有精确列顺序的表

我遵循了第二部分,并进行了编译。但是,在运行时它会抛出一个错误

错误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>

由于您返回的对象不是实体,您不需要跟踪它们,您可以尝试将它们更改为ComplexTypes,并在ReturnType元素中删除EntitySet属性吗?ComplexTypes没有EntitySets,因此您的错误应该消失。