4

Closed

Code First: Platform differences cause pre-generated view mismatch due to column ordering

description

We need to do something to ensure view that are generated on one platform won't be considered 'out-of-date' on a platform that gives a different reflection order for properties (and therefore a different column order in SSDL).

We originally did alphabetical sorting of columns in Code First which avoided this issue... but we got a LOT of feedback that column order should match the order that properties are defined in the class. Reflection order doesn't guarantee this but we aren't seeing any complaints about ordering with the current implementation.

We've come up with two ways to fix this:
  • Just use alphabetical sorting in SSDL but add an attribute with desired ordering in the database we create so that columns in the database are generated in reflection/configured order.
  • Improve the view hashing algorithm to ignore column ordering (this is part of some larger view hashing improvements we are tracking - http://entityframework.codeplex.com/workitem/606)
Closed Jan 21 at 6:04 PM by BriceLambson

comments

dun3 wrote Jan 25, 2013 at 8:22 AM

We tracked it down to properties in a second partial class that are not processed equally on all our machines. It seems as if sometimes the properties in the second partial class are discovered before and sometimes after the properties in the "main" partial class.

HTH

moozzyk wrote Jan 29, 2013 at 11:19 PM

See more comments on this here: http://entityframework.codeplex.com/workitem/26

BriceLambson wrote Mar 8, 2013 at 6:04 PM

emilcicos wrote Apr 26, 2013 at 3:55 AM

Updated the code that creates the hash to sort all sequences before being enumerated. This way the hash does not change if the order of items is different.

BriceLambson wrote Jan 20 at 7:18 PM

Fixed in changeset 7bd2698ee90d18026ca25a2b5307c0f2a3617bf7