How to format DBML code automatically?

Hi everyone, I’m wondering if there is a way to automatically format the DBML code, for example by sorting the tables and their columns in alphabetical order. This would make the code more readable and consistent. Is there a feature or tool that can do this? Thanks in advance for your help.

I doubt many people would use this functionality. In all the time I’ve been working with SQL I’ve never seen table columns arranged alphabetically simply because of the accepted convention of having the primary key as the first column.

Being able to sort tables alphabetically might be more useful, although I place related tables together in the DBML. Using table groups would allow for a logical grouping if the tables are alphabetical.

A quick format to fix indentations and extra spaces would be a nice feature.

I agree @jlneto. A quick format to fix indentation and extra spaces would be a nice feature. I also think that formatting everything the same way, since there are multiple ways to write DBML code, would also be nice. It would make the code more consistent and easier to read.

2 Likes