private void AddEntitiesAndRelationships(EntitySet entitySet) { foreach (var entity in entitySet.Entities.OrderBy(e => e.Name)) { controller.AddEntity(entity); } // Have to add all entities before adding relationships foreach (Entity entity in entitySet.Entities.OrderBy(e => e.Name)) { foreach (var rel in entity.References.OrderBy(r => r.End1Name)) { controller.AddRelationship(rel); } } // Add all inheritance relationships foreach (var entity in entitySet.Entities.OrderBy(e => e.Name)) { if (entity.Parent != null) { controller.AddParentChildRelationship(entity.Parent, entity); } } }
protected virtual void OnChildAdded(Entity child, Entity newParent) { schemaController.AddParentChildRelationship(child, newParent); }