Entity Framework - Colored Entities


Advertisements

In Entity Framework, Colored Entity is mainly all about changing the color of entity in the designer so that it is easy for developers to identify related groups of entities in the Visual Studio designer. This feature was first introduced in Entity Framework 5.0.

  • This feature has nothing to do with performance aspects.

  • When you have a large scale project and many entities in one edmx file, then this feature is very helpful to separate your entities in different modules.

If you are working with edmx file and you have opened it in designer, to change the color, select an entity on the design windows. Then right click and select Properties.

Edmx File Designer Edmx File

In the Properties window, select the Fill Color property.

Color Property Window

Specify the color using either a valid color name, for example, Green or a valid RGB (255, 128, 128) or you can also select from the color picker.

Color

To change the color of multiple entities in one go, select multiple entities and change Fill Color for all of them using the property window.

Multiple Entities

You can also change the format of properties by selecting any of the following options −

  • Display Name
  • Display Name and Type

By default, display name option is selected. To change the property format, right-click on the designer window.

Property Format

Select Scalar Property Format → Display Name and Type.

Scalar Property Format

You can now see that the type is also displayed along with the name.

Advertisements