I'm trying to use Entity Framework to save a record to the Address table of our SQL Server database, but upon the call to context.SaveChanges, I get an exception saying "An error occurred while updating the entries. See the inner exception for details." Upon inspection of the inner exception, there's a message, "Invalid column name 'Telephone_TelephoneID'."
The Address table does not have a "TelephoneID" column. It may have had one at one time, but we're sure we removed any trace of it; there's no mention of such a column in any keys, constraints, or indexes of the Address table. The entity class for an address record, an instance of which I add to the context, has no "TelephoneID" property. The Telephone table does have a "TelephoneID" column, but I'm not involving it or its entity class in any way.
Where could this error possibly be coming from? Thanks in advance...
EDIT -- While debugging and watching the context object, we noticed that the Addresses property evaluates as:
{SELECT
1 AS [C1],
[Extent1].[AddressID] AS [AddressID],
[Extent1].[AddressTypeID] AS [AddressTypeID],
[Extent1].[City] AS [City],
[Extent1].[CompanyID] AS [CompanyID],
[Extent1].[Country] AS [Country],
[Extent1].[County] AS [County],
[Extent1].[Extra] AS [Extra],
[Extent1].[State] AS [State],
[Extent1].[Street] AS [Street],
[Extent1].[Zip] AS [Zip],
[Extent1].[UpdateTimeStampUtc] AS [UpdateTimeStampUtc],
[Extent1].[UpdateUserGUID] AS [UpdateUserGUID],
[Extent1].[UpdateUserID] AS [UpdateUserID],
[Extent1].[Telephone_TelephoneID] AS [Telephone_TelephoneID]
FROM [Sales].[Address] AS [Extent1]}
I'm guessing this is left over from when the table once had this column. Since I do not know how this query value is created or where it's stored (solution-wide search for "Telephone_TelephoneID" turned up nothing), how can I correct it?