ASP.NET MVC3 Entitiy Framework - The EntitySet 'x' specified as part of this MSL does not exist in MetadataWorkspace

tortuga picture tortuga · Sep 22, 2011 · Viewed 12.1k times · Source

I'm making an reservation system.

The following query

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

gives me the following error

Error 54 Error 2003: The EntitySet 'Reservaties' specified as part of this MSL does not exist in MetadataWorkspace. ...\www\Models\xxx.edmx

It looks like it can 't find my table.

The edmx file is showing my database correctly, I worked several time like that already. I checked the MSL and saw nothing special. The problem is that I don't have any clue where to look for the problem.

Could my integrated N2CMS (dinamico package) have anything to do with this? (It's using nHibernate)

Any idea where to start?

Maybe the edmx is helpfull

<?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>

Everything under C-S mapping content is marked as error.

And I got "The EntitySet 'X' specified as part of this MSL does not exist in MetadataWorkspace." for all my tables.

I'm clueless...

Answer

tortuga picture tortuga · Sep 28, 2011

Forgot to add a reference the MySql.Data.Entity dll...