This project is read-only.


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


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 -
Closed Jan 21, 2014 at 7:04 PM by BriceLambson


dun3 wrote Jan 25, 2013 at 9: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.


moozzyk wrote Jan 30, 2013 at 12:19 AM

See more comments on this here:

BriceLambson wrote Mar 8, 2013 at 7:04 PM

emilcicos wrote Apr 26, 2013 at 4: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, 2014 at 8:18 PM

Fixed in changeset 7bd2698ee90d18026ca25a2b5307c0f2a3617bf7