views:

616

answers:

1

I have a Consumer class and a BillableConsumer : Consumer class. When trying to do any operation on my "Consumers" set, I get the error message "Object mapping could not be found for Type with identity Models.BillableConsumer.

From the CSDL:

    <EntityType Name="BillableConsumer" BaseType="Models.Consumer">
      <Property Type="String" Name="CardExpiratoin" Nullable="false" />
      <Property Type="String" Name="CardNumber" Nullable="false" />
      <Property Type="String" Name="City" Nullable="false" />
      <Property Type="String" Name="Country" Nullable="false" />
      <Property Type="String" Name="CVV" Nullable="false" />
      <Property Type="String" Name="NameOnCard" Nullable="false" />
      <Property Type="String" Name="PostalCode" Nullable="false" />
      <Property Type="String" Name="State" />
      <Property Type="String" Name="StreetAddress" Nullable="false" />
    </EntityType>

From the C-S:

     <EntitySetMapping Name="Consumers">
        <EntityTypeMapping TypeName="IsTypeOf(Models.Consumer)">
          <MappingFragment StoreEntitySet="consumer">
            <ScalarProperty Name="LoginID" ColumnName="LoginID" />
            <ScalarProperty Name="FirstName" ColumnName="FirstName" />
            <ScalarProperty Name="LastName" ColumnName="LastName" />
          </MappingFragment>
        </EntityTypeMapping>
        <EntityTypeMapping TypeName="IsTypeOf(Models.BillableConsumer)">
          <MappingFragment StoreEntitySet="billinginformation">
            <ScalarProperty Name="CardExpiratoin" ColumnName="CardExpiratoin" />
            <ScalarProperty Name="CardNumber" ColumnName="CardNumber" />
            <ScalarProperty Name="City" ColumnName="City" />
            <ScalarProperty Name="Country" ColumnName="Country" />
            <ScalarProperty Name="CVV" ColumnName="CVV" />
            <ScalarProperty Name="LoginID" ColumnName="LoginID" />
            <ScalarProperty Name="NameOnCard" ColumnName="NameOnCard" />
            <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
            <ScalarProperty Name="State" ColumnName="State" />
            <ScalarProperty Name="StreetAddress" ColumnName="StreetAddress" />
          </MappingFragment>
        </EntityTypeMapping>
      </EntitySetMapping>

Is this because I did not specifically add the BillableConsumer entity to the object set? How do I do that in a POCO scenario?

+1  A: 

If you notice in my CSDL there is a column called "CardExpiratoin" (spelling mistake in DB column name). Of course my class which was hand-coded did not have this spelling mistake.

The way I found the problem is by generating POCOs from the T4 template, seeing it worked, and working my way back from there. Hope this helps anyone with the same problem. I also wish the error was a bit clearer to begin with.

Juvaly