Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework - Is there a way to reorder properties in the EDMX designer?

I'm using Entity Framework's model designer to design the model for a new project.

Adding properties is relatively easy, however they're always appended to the entity.

Is there a way to reorder the properties once they've been added? This is quite annoying!

like image 908
Drew Noakes Avatar asked Aug 16 '10 22:08

Drew Noakes


People also ask

How do you modify EDMX if changes are made in the Database?

Delete existing model and then update: Delete key to delete all models in the designer. IMPORTANT: Do not save the EDMX at this point if you are using TFS for source control!* Now right-click and select "Update Model from Database" to recreate the entire model again. Rebuild project to propagate changes.

What is the importance of EDMX file in Entity Framework?

An . edmx file is an XML file that defines a conceptual model , a storage model , and the mapping between these models. An . edmx file also contains information that is used by the ADO.NET Entity Data Model Designer (Entity Designer) to render a model graphically.

Is EDMX entity framework?

edmx is basically an XML file which is generated when we added Entity Framework model. It is Entity Data Model Xml which contains designer (Model) and code file(. cs).


2 Answers

In VS2012 it's much easier: just press alt + up/down with the property selected.

like image 137
Dave Avatar answered Sep 18 '22 14:09

Dave


I assume by "reorder the properties" you mean the order that the properties are show up in the EDM designer and if that's what you mean then Yes, there is:
1. Right Click on your edmx file in solution explorer and choose "Open With..."
2. Select the 2nd item: Automatic Editor Selector(XML) and click OK.
3. Click on Yes where it ask if you want to close the edmx file.
4. Now you should see the XML file that is being created behind the scene.
5. Find your EntityType node that you need to reorder its properties: it is in the CSDL content like: < EntityType Name="yourEntityName">. Underneath there are a whole bunch of property nodes: < Property Type="" Name=""... Change the order of the scalar properties, save and double click on the edmx file to open it in designer mode again... You'll see that the order has been changed!

like image 25
Morteza Manavi Avatar answered Sep 19 '22 14:09

Morteza Manavi