views:

37

answers:

0

I've got an Entity Framework 4 EDMX using Table Per Type inheritance between one base table and two inheriting tables that looks something like this (table names changed and a lot of unrelated stuff removed).

<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx"&gt;
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="SooperdooperModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl"&gt;
        <EntityContainer Name="SooperdooperModelStoreContainer">
          <EntitySet Name="tblApp" EntityType="SooperdooperModel.Store.tblApp" store:Type="Tables" Schema="dbo" />
          <EntitySet Name="tblAppFoo" EntityType="SooperdooperModel.Store.tblAppFoo" store:Type="Tables" Schema="dbo" />
          <EntitySet Name="tblAppBar" EntityType="SooperdooperModel.Store.tblAppBar" store:Type="Tables" Schema="dbo" />
          <AssociationSet Name="FK_tblAppFoo_tblApp" Association="SooperdooperModel.Store.FK_tblAppFoo_tblApp">
            <End Role="tblApp" EntitySet="tblApp" />
            <End Role="tblAppFoo" EntitySet="tblAppFoo" />
          </AssociationSet>
          <AssociationSet Name="FK_tblAppBar_tblApp" Association="SooperdooperModel.Store.FK_tblAppBar_tblApp">
            <End Role="tblApp" EntitySet="tblApp" />
            <End Role="tblAppBar" EntitySet="tblAppBar" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="tblApp">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="uniqueidentifier" Nullable="false" />
          <Property Name="Comments" Type="varchar" MaxLength="5000" />
        </EntityType>
        <EntityType Name="tblAppFoo">
          <Key>
            <PropertyRef Name="AppID" />
          </Key>
          <Property Name="AppID" Type="uniqueidentifier" Nullable="false" />
          <Property Name="Cost" Type="money" Nullable="false" />
          <Property Name="Quantity" Type="int" Nullable="false" />
        </EntityType>
        <EntityType Name="tblAppBar">
          <Key>
            <PropertyRef Name="AppID" />
          </Key>
          <Property Name="AppID" Type="uniqueidentifier" Nullable="false" />
          <Property Name="UnitCost" Type="money" Nullable="false" />
          <Property Name="Quantity" Type="int" Nullable="false" />
        </EntityType>
        <Association Name="FK_tblAppFoo_tblApp">
          <End Role="tblApp" Type="SooperdooperModel.Store.tblApp" Multiplicity="1" />
          <End Role="tblAppFoo" Type="SooperdooperModel.Store.tblAppFoo" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="tblApp">
              <PropertyRef Name="ID" />
            </Principal>
            <Dependent Role="tblAppFoo">
              <PropertyRef Name="AppID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_tblAppBar_tblApp">
          <End Role="tblApp" Type="SooperdooperModel.Store.tblApp" Multiplicity="1" />
          <End Role="tblAppBar" Type="SooperdooperModel.Store.tblAppBar" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="tblApp">
              <PropertyRef Name="ID" />
            </Principal>
            <Dependent Role="tblAppBar">
              <PropertyRef Name="AppID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="SooperdooperModel" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2008/09/edm"&gt;
        <EntityContainer Name="SooperdooperEntities" annotation:LazyLoadingEnabled="true">
          <EntitySet Name="Apps" EntityType="SooperdooperModel.App" />
        </EntityContainer>
        <EntityType Name="App">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="Guid" Nullable="false" />
          <Property Name="Comments" Type="String" MaxLength="5000" Unicode="false" FixedLength="false" />
        </EntityType>
        <EntityType Name="AppFoo" BaseType="SooperdooperModel.App">
          <Property Name="Cost" Type="Decimal" Nullable="false" Precision="19" Scale="4" />
          <Property Name="Quantity" Type="Int32" Nullable="false" />
        </EntityType>
        <EntityType Name="AppBar" BaseType="SooperdooperModel.App">
          <Property Name="UnitCost" Type="Decimal" Nullable="false" Precision="19" Scale="4" />
          <Property Name="Quantity" Type="Int32" 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"&gt;
        <EntityContainerMapping StorageEntityContainer="SooperdooperModelStoreContainer" CdmEntityContainer="SooperdooperEntities">
          <EntitySetMapping Name="Apps">
            <EntityTypeMapping TypeName="IsTypeOf(SooperdooperModel.App)">
              <MappingFragment StoreEntitySet="tblApp">
                <ScalarProperty Name="ID" ColumnName="ID" /> <!-- Error here -->
                <ScalarProperty Name="Comments" ColumnName="Comments" />
              </MappingFragment>
            </EntityTypeMapping>
            <EntityTypeMapping TypeName="IsTypeOf(SooperdooperModel.AppFoo)">
              <MappingFragment StoreEntitySet="tblAppFoo">
                <ScalarProperty Name="ID" ColumnName="ID" /> <!-- Error here -->
                <ScalarProperty Name="Cost" ColumnName="Cost" />
                <ScalarProperty Name="Quantity" ColumnName="Quantity" />
              </MappingFragment>
            </EntityTypeMapping>
            <EntityTypeMapping TypeName="IsTypeOf(SooperdooperModel.AppBar)">
              <MappingFragment StoreEntitySet="tblAppBar">
                <ScalarProperty Name="ID" ColumnName="ID" />
                <ScalarProperty Name="UnitCost" ColumnName="UnitCost" />
                <ScalarProperty Name="Quantity" ColumnName="Quantity" />
              </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"&gt;&lt;!-- EDITED MANUALLY :-P --></Designer>
</edmx:Edmx>

I'm getting an error that doesn't make any sense to me.

Error 2010: The Column 'AppID' specified as part of this MSL does not exist in MetadataWorkspace.

I actually get this error twice pointed at the lines I marked with an "Error here" comment in the sample EDMX. Any ideas on what this means or how to correct it?