Entities attempting to update computed columns
Entities attempting to update computed columns
If an Entity is generated from a table that contains a calculated column, it would appear, that the Entity framework treats this as a normal column and believes it is updateable.
Such an Entity if created with a new operator and subsequently added via AddToxxxx and saved via SaveChanges, results in an error.
The error is: "The Column" cannot be modified because it is a computed column, or a result of a union operator.
Why is it trying to update a calculated column ?
This is using the latest 2.50.50 version
Such an Entity if created with a new operator and subsequently added via AddToxxxx and saved via SaveChanges, results in an error.
The error is: "The Column" cannot be modified because it is a computed column, or a result of a union operator.
Why is it trying to update a calculated column ?
This is using the latest 2.50.50 version
I was just about to post that I had identified this as being the problem.AndreyR wrote:Please check that you have set StoreGeneratedPattern to "Computed" for the computed column in the Store part of the model.
The 'StoreGeneratedPattern' is not set automatically to 'Computed' for computed columns.
This means I am currently running the following SQL query to find all the computed columns in the Database, so they can be manually set.
Code: Select all
SELECT OBJECT_NAME(id) as ObjectName, Name as ComputedColumn
FROM syscolumns
WHERE COLUMNPROPERTY( id ,name, 'IsComputed') = 1
ORDER BY 1, 2