LINQ to Entities - how to persist column order?
-
Within LINQ to Entities entity model (supported by .edmx file) sometimes column order changes within the tables. It may happen after you’ve edited the table structure (added or deleted columns, renamed them, etc.). As a result an automatically generated Create method changes and existing code becomes broken. Example: You have entity called Item. It has columns ColA, ColB, ColC. Entity model designer generated method Item.CreateItem(ColA, ColB, ColC) for you. After some changes (which by the way have nothing to do with ColA, ColB, ColC !) the CreateItem method is now Item.CreateItem(ColB, ColA, ColC) As a result all your existing code, which calls CreateItem method, fails. Very annoying. Did anybody find the way how to persist the column order? Or at least how to control it? I tried to edit .edmx file directly and set up an order I need. But even this did not help. The Entity model designer is not following this order and it looks like it is picking up the order randomly.
-
Within LINQ to Entities entity model (supported by .edmx file) sometimes column order changes within the tables. It may happen after you’ve edited the table structure (added or deleted columns, renamed them, etc.). As a result an automatically generated Create method changes and existing code becomes broken. Example: You have entity called Item. It has columns ColA, ColB, ColC. Entity model designer generated method Item.CreateItem(ColA, ColB, ColC) for you. After some changes (which by the way have nothing to do with ColA, ColB, ColC !) the CreateItem method is now Item.CreateItem(ColB, ColA, ColC) As a result all your existing code, which calls CreateItem method, fails. Very annoying. Did anybody find the way how to persist the column order? Or at least how to control it? I tried to edit .edmx file directly and set up an order I need. But even this did not help. The Entity model designer is not following this order and it looks like it is picking up the order randomly.
I haven't experienced this and can't seem to reproduce it
I know the language. I've read a book. - _Madmatt
-
I haven't experienced this and can't seem to reproduce it
I know the language. I've read a book. - _Madmatt
Well, it is obviously difficult to reproduce as effect is random. Sometimes it happens sometimes it does not.