We are starting on a new version of our product and decided to use POCO objects with EF while keeping backwards compatibility with the existing databases.
The problem is that i have a credit card object with a property BillingAddress that is of type Address. In the new database model all address are stored in the address table, in the old database address where stored in the table to which they belonged, so the credit card table had the address fields in the table.
On the address object has a property Country which is not stored in the old CreditCard database so I get the following exception
System.InvalidOperationException: The property 'CreditCard.BillingAddress.Counrty' is not mapped for entity type 'CreditCard'. Specify a hierarchy or single type mapping for the type 'CreditCard' that includes a column mapping for this property.
I am using this example to map my complex type to the CC table http://weblogs.asp.net/scottgu/archive/2010/07/23/entity-framework-4-code-first-custom-database-schema-mapping.aspx
this to be precise http://weblogs.asp.net/blogs/scottgu/image_thumb_2879A6CF.png
I guess my question is, is there a way to have a property on a object that doesn't get mapped to the data source.
Thank you