AddHierarchy is used to create a hierarchy relationship between different entities. An entity hierarchy shows the relationship between different entity types. An entity hierarchy always has a parent entity and child entity. A parent entity is above another entity on the hierarchy and conversely a child entity is below another entity on the hierarchy.
Menu’s are a good example of an entity hierarchy. In a menu entity hierarchy, the parent entity is the menu and the child entities are the menu items. In the below example, you can see that there is a menu with four menu items (Item Catalog, Place Order, Inquiry, Finance). The parent entity is the menu entity and the child entities are the menu items in this example.