ASP.NET MVC3 实体框架 - EntitySet 'x'指定为此 MSL 的一部分在 MetadataWorkspace 中不存在
我正在做一个预订系统。
以下查询
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>
CS 映射内容下的所有内容都被标记为错误。
我收到“指定为此 MSL 一部分的 EntitySet 'X' 在 MetadataWorkspace 中不存在。”对于我所有的桌子。
我一无所知...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
忘记添加 MySql.Data.Entity dll 的引用...
Forgot to add a reference the MySql.Data.Entity dll...
您最好检查 ....... >,属于 .EDMX 文件中使用的复杂类型。
它应该匹配 .... >
它解决了我的问题...
You better check for the <edmx:ConceptualModels> <Schema Namespace="?????" ....... >, of the Complex type being used in the .EDMX file.
It should match to <ComplexTypeMapping TypeName="?????.ComplexTypeName" .... >
It resolved my issue...