ASP.NET MVC3 Entitiy Framework - EntitySet 'x', указанный как часть этого MSL, не существует в MetadataWorkspace - PullRequest
3 голосов
/ 22 сентября 2011

Я делаю систему бронирования.

Следующий запрос

    Reservatie r = (from res in entities.Reservaties
    where (res.datum == date && res.tijdslot == time)
    select res).FirstOrDefault();

дает мне следующую ошибку

Ошибка 54 Ошибка 2003: EntitySet 'Reservaties' указанный как часть этого MSL не существует в MetadataWorkspace. ... \ WWW \ Models \ xxx.edmx

Похоже, он не может найти мой стол.

Файл edmx правильно показывает мою базу данных, я уже несколько раз работал так. Я проверил MSL и ничего особенного не увидел. Проблема в том, что я понятия не имею, где искать проблему.

Может ли мой интегрированный N2CMS (пакет dinamico) иметь какое-либо отношение к этому? (Он использует nHibernate)

Есть идеи, с чего начать?

Может быть, edmx полезен

<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
      <Schema Namespace="Model.Store" Alias="Self" Provider="MySql.Data.MySqlClient" ProviderManifestToken="5.1" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityContainer Name="ModelStoreContainer">
          <EntitySet Name="arrangementen" EntityType="Model.Store.arrangementen" store:Type="Tables" Schema="xxx" />
          <EntitySet Name="complexen" EntityType="Model.Store.complexen" store:Type="Tables" Schema="xxx" />
          <EntitySet Name="klanten" EntityType="Model.Store.klanten" store:Type="Tables" Schema="xxx" />
          <EntitySet Name="reservaties" EntityType="Model.Store.reservaties" store:Type="Tables" Schema="xxx" />
          <EntitySet Name="reservatiestatussen" EntityType="Model.Store.reservatiestatussen" store:Type="Tables" Schema="xxx" />
        </EntityContainer>
        <EntityType Name="arrangementen">
          <Key>
            <PropertyRef Name="arrangementId" />
          </Key>
          <Property Name="arrangementId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="naam" Type="varchar" Nullable="false" MaxLength="255" />
          <Property Name="beschrijving" Type="text" />
          <Property Name="prijs" Type="decimal" Nullable="false" />
          <Property Name="van" Type="int" />
          <Property Name="tot" Type="int" />
          <Property Name="toegelaten_statussen" Type="varchar" Nullable="false" MaxLength="50" />
        </EntityType>
        <EntityType Name="complexen">
          <Key>
            <PropertyRef Name="complexId" />
          </Key>
          <Property Name="complexId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="naam" Type="varchar" Nullable="false" MaxLength="255" />
          <Property Name="openingsuur" Type="int" Nullable="false" />
          <Property Name="sluitingsuur" Type="int" Nullable="false" />
        </EntityType>
        <EntityType Name="klanten">
          <Key>
            <PropertyRef Name="KlantId" />
          </Key>
          <Property Name="KlantId" Type="bigint" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="voornaam" Type="varchar" Nullable="false" MaxLength="100" />
          <Property Name="achternaam" Type="varchar" Nullable="false" MaxLength="150" />
          <Property Name="email" Type="varchar" Nullable="false" MaxLength="150" />
        </EntityType>
        <EntityType Name="reservaties">
          <Key>
            <PropertyRef Name="reservatieId" />
          </Key>
          <Property Name="reservatieId" Type="bigint" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="klantId" Type="bigint" Nullable="false" />
          <Property Name="datum" Type="date" Nullable="false" />
          <Property Name="tijdslot" Type="int" Nullable="false" />
          <Property Name="complexId" Type="int" Nullable="false" />
          <Property Name="arrangementId" Type="int" />
          <Property Name="statusId" Type="int" Nullable="false" />
          <Property Name="recurringDaily" Type="bit" />
          <Property Name="recurringWeekly" Type="bit" />
          <Property Name="recurringMonthly" Type="bit" />
          <Property Name="recurringYearly" Type="bit" />
        </EntityType>
        <EntityType Name="reservatiestatussen">
          <Key>
            <PropertyRef Name="statusId" />
          </Key>
          <Property Name="statusId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="statusnaam" Type="varchar" Nullable="false" MaxLength="255" />
        </EntityType>
      </Schema>
    </edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="Model" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="ALEntities" annotation:LazyLoadingEnabled="true">
          <EntitySet Name="Arrangementen" EntityType="Model.Arrangement" />
          <EntitySet Name="Complexen" EntityType="Model.Complex" />
          <EntitySet Name="Klanten" EntityType="Model.Klant" />
          <EntitySet Name="Reservaties" EntityType="Model.Reservatie" />
          <EntitySet Name="Reservatiestatussen" EntityType="Model.Reservatiestatus" />
        </EntityContainer>
        <EntityType Name="Arrangement">
          <Key>
            <PropertyRef Name="arrangementId" />
          </Key>
          <Property Name="arrangementId" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="naam" Type="String" Nullable="false" />
          <Property Name="beschrijving" Type="String" />
          <Property Name="prijs" Type="Decimal" Nullable="false" />
          <Property Name="van" Type="Int32" />
          <Property Name="tot" Type="Int32" />
          <Property Name="toegelaten_statussen" Type="String" Nullable="false" />
        </EntityType>
        <EntityType Name="Complex">
          <Key>
            <PropertyRef Name="complexId" />
          </Key>
          <Property Name="complexId" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="naam" Type="String" Nullable="false" />
          <Property Name="openingsuur" Type="Int32" Nullable="false" />
          <Property Name="sluitingsuur" Type="Int32" Nullable="false" />
        </EntityType>
        <EntityType Name="Klant">
          <Key>
            <PropertyRef Name="KlantId" />
          </Key>
          <Property Name="KlantId" Type="Int64" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="voornaam" Type="String" Nullable="false" />
          <Property Name="achternaam" Type="String" Nullable="false" />
          <Property Name="email" Type="String" Nullable="false" />
        </EntityType>
        <EntityType Name="Reservatie">
          <Key>
            <PropertyRef Name="reservatieId" />
          </Key>
          <Property Name="reservatieId" Type="Int64" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="klantId" Type="Int64" Nullable="false" />
          <Property Name="datum" Type="DateTime" Nullable="false" />
          <Property Name="tijdslot" Type="Int32" Nullable="false" />
          <Property Name="complexId" Type="Int32" Nullable="false" />
          <Property Name="arrangementId" Type="Int32" />
          <Property Name="statusId" Type="Int32" Nullable="false" />
          <Property Name="recurringDaily" Type="Boolean" />
          <Property Name="recurringWeekly" Type="Boolean" />
          <Property Name="recurringMonthly" Type="Boolean" />
          <Property Name="recurringYearly" Type="Boolean" />
        </EntityType>
        <EntityType Name="Reservatiestatus">
          <Key>
            <PropertyRef Name="statusId" />
          </Key>
          <Property Name="statusId" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="statusnaam" Type="String" Nullable="false" />
        </EntityType>
      </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="ModelStoreContainer" CdmEntityContainer="ALEntities">
          <EntitySetMapping Name="Arrangementen"><EntityTypeMapping TypeName="Model.Arrangement"><MappingFragment StoreEntitySet="arrangementen">
            <ScalarProperty Name="arrangementId" ColumnName="arrangementId" />
            <ScalarProperty Name="naam" ColumnName="naam" />
            <ScalarProperty Name="beschrijving" ColumnName="beschrijving" />
            <ScalarProperty Name="prijs" ColumnName="prijs" />
            <ScalarProperty Name="van" ColumnName="van" />
            <ScalarProperty Name="tot" ColumnName="tot" />
            <ScalarProperty Name="toegelaten_statussen" ColumnName="toegelaten_statussen" />
          </MappingFragment></EntityTypeMapping></EntitySetMapping>
          <EntitySetMapping Name="Complexen"><EntityTypeMapping TypeName="Model.Complex"><MappingFragment StoreEntitySet="complexen">
            <ScalarProperty Name="complexId" ColumnName="complexId" />
            <ScalarProperty Name="naam" ColumnName="naam" />
            <ScalarProperty Name="openingsuur" ColumnName="openingsuur" />
            <ScalarProperty Name="sluitingsuur" ColumnName="sluitingsuur" />
          </MappingFragment></EntityTypeMapping></EntitySetMapping>
          <EntitySetMapping Name="Klanten"><EntityTypeMapping TypeName="Model.Klant"><MappingFragment StoreEntitySet="klanten">
            <ScalarProperty Name="KlantId" ColumnName="KlantId" />
            <ScalarProperty Name="voornaam" ColumnName="voornaam" />
            <ScalarProperty Name="achternaam" ColumnName="achternaam" />
            <ScalarProperty Name="email" ColumnName="email" />
          </MappingFragment></EntityTypeMapping></EntitySetMapping>
          <EntitySetMapping Name="Reservaties"><EntityTypeMapping TypeName="Model.Reservatie"><MappingFragment StoreEntitySet="reservaties">
            <ScalarProperty Name="reservatieId" ColumnName="reservatieId" />
            <ScalarProperty Name="klantId" ColumnName="klantId" />
            <ScalarProperty Name="datum" ColumnName="datum" />
            <ScalarProperty Name="tijdslot" ColumnName="tijdslot" />
            <ScalarProperty Name="complexId" ColumnName="complexId" />
            <ScalarProperty Name="arrangementId" ColumnName="arrangementId" />
            <ScalarProperty Name="statusId" ColumnName="statusId" />
            <ScalarProperty Name="recurringDaily" ColumnName="recurringDaily" />
            <ScalarProperty Name="recurringWeekly" ColumnName="recurringWeekly" />
            <ScalarProperty Name="recurringMonthly" ColumnName="recurringMonthly" />
            <ScalarProperty Name="recurringYearly" ColumnName="recurringYearly" />
          </MappingFragment></EntityTypeMapping></EntitySetMapping>
          <EntitySetMapping Name="Reservatiestatussen"><EntityTypeMapping TypeName="Model.Reservatiestatus"><MappingFragment StoreEntitySet="reservatiestatussen">
            <ScalarProperty Name="statusId" ColumnName="statusId" />
            <ScalarProperty Name="statusnaam" ColumnName="statusnaam" />
          </MappingFragment></EntityTypeMapping></EntitySetMapping>
        </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <Designer xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
    <Connection>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </Connection>
    <Options>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
        <DesignerProperty Name="EnablePluralization" Value="False" />
        <DesignerProperty Name="IncludeForeignKeysInModel" Value="False" />
      </DesignerInfoPropertySet>
    </Options>
    <!-- Diagram content (shape and connector positions) -->
    <Diagrams>
      <Diagram Name="xxx">
        <EntityTypeShape EntityType="Model.Arrangement" Width="1.5" PointX="0.75" PointY="0.75" Height="2.3648893229166665" IsExpanded="true" />
        <EntityTypeShape EntityType="Model.Complex" Width="1.5" PointX="2.75" PointY="0.75" Height="1.7879850260416674" IsExpanded="true" />
        <EntityTypeShape EntityType="Model.Klant" Width="1.5" PointX="2.75" PointY="3.75" Height="1.787985026041667" IsExpanded="true" />
        <EntityTypeShape EntityType="Model.Reservatie" Width="1.5" PointX="4.75" PointY="0.75" Height="3.1340950520833335" IsExpanded="true" />
        <EntityTypeShape EntityType="Model.Reservatiestatus" Width="1.5" PointX="4.75" PointY="4.75" Height="1.4033821614583317" IsExpanded="true" />
      </Diagram>
    </Diagrams>
  </Designer>
</edmx:Edmx>

Все, что находится под контентом C-S, помечено как ошибка.

И я получил "EntitySet 'X', указанный как часть этого MSL, не существует в MetadataWorkspace". для всех моих столов.

Я невежественен ...

Ответы [ 2 ]

2 голосов
/ 28 сентября 2011

Забыл добавить ссылку на MySql.Data.Entity dll ...

1 голос
/ 22 июля 2016

Вам лучше проверить на, типа Complex, используемого в файле .EDMX.

должно соответствовать

Это решило мою проблему ...

...