Sort and autoformat xml inside .edmx files before saving via EF Designer
Need the EF designer to generate nodes inside .edmx file in exactly the same order they are present in the database (currently a list of entity properties is saved in reverse order in mappings section, also when you update the model from the database schema the ordering is messed up). Also before saving .edmx file EF Designer should auto format the document. This would help significantly with branching, merging and resolving conflicts during merge operations of .edmx files.
Steps to reproduce: (1) Generate EF data model based on an existing database (2) Add a couple of new columns, indexes, foreign keys (3) Regenerate the model based on the updated db schema (4) Open .edmx in XML editor and check that for example a list of property nodes is no longer sorted as it should be also sorting differs in model, store and mapping sections.
Thanks for taking the time to share this suggestion. This item has been around for a couple of versions of Visual Studio and we haven’t acted on it. Looking at the VS “15” plans, we’re not going to take action on this item, so we’re going to close it. If the suggestion is still relevant, please either take a look to see if there’s another suggestion that’s similar that you can vote on, or open a new suggestion.
- The Visual Studio Team
Steven T. Cramer commented
To sort your edmx properties alphabetically, see the answer here and the comment on line to change.
You could also sort everything different (e.g. alphabetically), as long as it is deterministic for both elements and attributes. That makes version control (diff-ing and merging) a lot easier!
For work-arounds, see also http://stackoverflow.com/questions/1424029/xml-sorting-formatting-tool .