Hey all,
I am trying to add a property to one of the generated data classes the Entity Framework has created for me. I have done the exact same thing on another generated class without a problem and for some reason it won't work on this one.
The only difference between the two generated objects is one is just a straight table mapping (the one that works) and the other inherits from another object (the one that doesn't work). In other words one table represents two entities and based on some criteria i've abstracted it up and created two inheriting entities...
<EntityType Name="Product" Abstract="true">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="String" Nullable="false" />
</EntityType>
<EntityType Name="Key" BaseType="MyEntities.Product">
<Property Name="Status" Type="String" Nullable="true" />
<Property Name="SerialNumberString" Type="String" Nullable="true" />
</EntityType>
<EntityType Name="License" BaseType="MyEntities.Product" >
<Property Name="ProductCode" Type="String" Nullable="true" />
<Property Name="Version" Type="String" Nullable="true" />
</EntityType>
Ive then added the property in follows...
public partial class Key
{
public int? SerialNumber
{
get
{
int serialNumber;
if (int.TryParse(SerialNumberString, out serialNumber))
{
return serialNumber;
}
return null;
}
set
{
SerialNumberString = value.ToString();
ReportPropertyChanged("SerialNumber");
}
}
}
Now when ReportPropertyChanged gets called it throws this exception:
System.ArgumentException: The property 'SerialNumber' does not have a valid entity mapping on the entity object. For more information, see the Entity Framework documentation.
I have IDENTICAL code in another generated data class which does not throw, the only difference is the inheritance, whats going on??