Entities attempting to update computed columns

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
Discovery
Posts: 14
Joined: Thu 24 Sep 2009 15:10

Entities attempting to update computed columns

Post by Discovery » Wed 25 Nov 2009 17:14

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

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 26 Nov 2009 16:34

Please check that you have set StoreGeneratedPattern to "Computed" for the computed column in the Store part of the model.

Discovery
Posts: 14
Joined: Thu 24 Sep 2009 15:10

Post by Discovery » Thu 26 Nov 2009 16:43

AndreyR wrote:Please check that you have set StoreGeneratedPattern to "Computed" for the computed column in the Store part of the model.
I was just about to post that I had identified this as being the problem.

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
Surely the Entity Developer should be doing this for me ?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 27 Nov 2009 15:22

What DBMS are you using?

Discovery
Posts: 14
Joined: Thu 24 Sep 2009 15:10

Post by Discovery » Sat 28 Nov 2009 14:31

SQL Server 2005

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 30 Nov 2009 17:00

Thank you for the report, we have reproduced the problem.
I will let you know about the results of our investigation.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 14 Dec 2009 11:53

We have fixed the problem. The fix will be available in the nearest build.

Discovery
Posts: 14
Joined: Thu 24 Sep 2009 15:10

Post by Discovery » Mon 14 Dec 2009 12:14

AndreyR wrote:We have fixed the problem. The fix will be available in the nearest build.
I must be going crazy, as I was sure that you had fixed this problem in the current version (2.50.50) :wink:

Post Reply