src/Misc/EFTools/EntityDesignEntityDesigner/CustomCode/Diagram/EntityDesignerDiagram.cs
/// <summary>
///     Creates new inheritance for given EntityTypeShape
/// </summary>
/// <param name="entityShape"></param>
/// <returns></returns>
Creates new inheritance for given EntityTypeShape
Creates new inheritance for given EntityTypeShape
[SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults")]
        internal void AddNewInheritance(EntityTypeShape entityShape)
        {
            if ((Partition.GetLocks() & Locks.Add) == Locks.Add)
            {
                return;
            }
            ViewModelEntityType baseEntity = null;
            ConceptualEntityType modelEntity = null;
            if (entityShape != null)
            {
                baseEntity = entityShape.ModelElement as ViewModelEntityType;
                modelEntity = ModelElement.ModelXRef.GetExisting(baseEntity) as ConceptualEntityType;
                Debug.Assert(modelEntity != null);
            }
            var model = ModelElement.ModelXRef.GetExisting(ModelElement) as ConceptualEntityModel;
            Debug.Assert(model != null);
            var cets = new List<ConceptualEntityType>(model.EntityTypes().Cast<ConceptualEntityType>());
            using (var dialog = new NewInheritanceDialog(modelEntity, cets))
            {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    using (var t = Store.TransactionManager.BeginTransaction(EntityDesignerResources.Tx_AddInheritance))
                    {
                        t.Context.Add(EfiTransactionOriginator.TransactionOriginatorDiagramId, DiagramId);
                        ViewModelChangeContext.GetNewOrExistingContext(t).ViewModelChanges.Add(new Inheritance_AddFromDialog(dialog));
                        t.Commit();
                    }
                }
            }
        }
[ SuppressMessage ( " " , " " ) ] internal void AddNewInheritance ( EntityTypeShape entityShape ) { if ( ( Partition . GetLocks ( ) & Locks . Add ) == Locks . Add ) { return ; } ViewModelEntityType baseEntity = null ; ConceptualEntityType modelEntity = null ; if ( entityShape != null ) { baseEntity = entityShape . ModelElement as ViewModelEntityType ; modelEntity = ModelElement . ModelXRef . GetExisting ( baseEntity ) as ConceptualEntityType ; Debug . Assert ( modelEntity != null ) ; } var model = ModelElement . ModelXRef . GetExisting ( ModelElement ) as ConceptualEntityModel ; Debug . Assert ( model != null ) ; var cets = new List < ConceptualEntityType > ( model . EntityTypes ( ) . Cast < ConceptualEntityType > ( ) ) ; using ( var dialog = new NewInheritanceDialog ( modelEntity , cets ) ) { if ( dialog . ShowDialog ( ) == DialogResult . OK ) { using ( var t = Store . TransactionManager . BeginTransaction ( EntityDesignerResources . Tx_AddInheritance ) ) { t . Context . Add ( EfiTransactionOriginator . TransactionOriginatorDiagramId , DiagramId ) ; ViewModelChangeContext . GetNewOrExistingContext ( t ) . ViewModelChanges . Add ( new Inheritance_AddFromDialog ( dialog ) ) ; t . Commit ( ) ; } } } }
Creates new inheritance for given EntityTypeShape
Creates new inheritance for given EntityTypeShape
// If user selected an EntityTypeShape, use corresponding EntityType // else default to first EntityType in the model
None
entityShape
EntityTypeShape
None