Working with large Entity Framework models in Visual Studio
Entity Framework has come a long way. It has provided a lot of flexibility and now with Code First, it is getting closer and closer to the flexibility of NHibernate. It still lacks some features that will hopefully be in the next drop.
An issue that I have run into in dealing with very large models in my projects is the lack of good designer support. Take the following screen shot from the AdventureWorks database:
When the model is this small, Visual Studio give us the ability to navigate between entities using the Property dropdown selector as seen here:
However if you have a model that is considerably larger model like the following screen shot:
The dropdown will no longer work as seen here:
Luckily there is still a way to navigate your large model without needing to drop everything and recreate. Let me introduce you to the Model Browser. To see the Model Browser, simply right click on the designer surface as shown below:
Select the Model Browser menu option. You then see a new Model Browswer tab:
If you expand the Entity Types folder you get the following view:
Finally, if you want to navigate to a particular entity, simply right click the entity as shown below:
Select the Show In Browser menu option and the designer will navigate and select the corresponding entity:
Now we are back in business. It isn’t as easy as the Property selector but it still gets the job done. It certainly has made my life easier.
This took me a while to figure out. I am not sure why but we had this horrible workflow trying to update one or two entities without dropping the whole model when the property selector stopped working.
Hope this helps….