How do i change order of properties in DBML file (L2S) I really do not want delete and then re-drop my table from database
One thing you can do is go to the Properties window (while you have your DBML file open), and select the class generated for the table you're interested in from the dropdown list at the top of the Properties window. Doing so should focus the DBML file visual designer on that table corresponding to that class.
dbml file will be added under App_Code folder. Expand Server Explorer and Right click on the Data Connections and select the option Add Connection. Add Connection Pop up will be opened, give the SQL Server details and select the then click on OK button. Database will be added under Data Connections as shown below.
You can do that by editing the dbml file in an xml editor (right-click on the dbml file in the solution explorer, select 'open with...', and then 'xml editor'). Rearrange the properties in the xml editor, then save the dbml file, switch back to the visual designer, make some minor change (e.g. layout change), and save again to force code-regeneration. The visual designer itself don't let you to rearrange columns in an easy manner.
If you're looking for a way to keep your properties in the same order as the db columns with minimal effort, take a look at my add-in; it adds full sync capability to the L2S designer in VS2008, VS2010, VS2012, and VS2013. It also has an option to keep the column order in sync between the database and L2S DBML file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With