src/Misc/EFTools/EntityDesignModel/Designer/Diagram.cs
/// <summary>
///     Return true if there is diagram object that represents efelement/efobject in the diagram.
/// </summary>
/// <param name="efObject"></param>
/// <returns></returns>
Return true if there is diagram object that represents efelement/efobject in the diagram.
Return true if there is diagram object that represents efelement / efobject in the diagram .
internal bool IsEFObjectRepresentedInDiagram(EFObject efObject)
        {
            var entityTypesInDiagram = EntityTypeShapes.Select(ets => ets.EntityType.Target).ToList();
            var entityType = efObject.GetParentOfType(typeof(ConceptualEntityType)) as ConceptualEntityType;
            var association = efObject.GetParentOfType(typeof(Association)) as Association;
            var associationSet = efObject as AssociationSet;
            var entitySet = efObject as EntitySet;
            if (associationSet != null
                && associationSet.Association.Status == BindingStatus.Known)
            {
                association = associationSet.Association.Target;
            }
            if (entitySet != null)
            {
                foreach (var et in entitySet.GetEntityTypesInTheSet())
                {
                    if (entityTypesInDiagram.Contains(et) == false)
                    {
                        return false;
                    }
                }
                return true;
            }
            else if (entityType != null)
            {
                return entityTypesInDiagram.Contains(entityType);
            }
            else if (association != null)
            {
                var associationsInDiagram = AssociationConnectors.Select(a => a.Association.Target).ToList();
                return associationsInDiagram.Contains(association);
            }
            return false;
        }
internal bool IsEFObjectRepresentedInDiagram ( EFObject efObject ) { var entityTypesInDiagram = EntityTypeShapes . Select ( ets => ets . EntityType . Target ) . ToList ( ) ; var entityType = efObject . GetParentOfType ( typeof ( ConceptualEntityType ) ) as ConceptualEntityType ; var association = efObject . GetParentOfType ( typeof ( Association ) ) as Association ; var associationSet = efObject as AssociationSet ; var entitySet = efObject as EntitySet ; if ( associationSet != null && associationSet . Association . Status == BindingStatus . Known ) { association = associationSet . Association . Target ; } if ( entitySet != null ) { foreach ( var et in entitySet . GetEntityTypesInTheSet ( ) ) { if ( entityTypesInDiagram . Contains ( et ) == false ) { return false ; } } return true ; } else if ( entityType != null ) { return entityTypesInDiagram . Contains ( entityType ) ; } else if ( association != null ) { var associationsInDiagram = AssociationConnectors . Select ( a => a . Association . Target ) . ToList ( ) ; return associationsInDiagram . Contains ( association ) ; } return false ; }
Return true if there is diagram object that represents efelement/efobject in the diagram.
Return true if there is diagram object that represents efelement / efobject in the diagram .
// if efobject is an associationset, check if the corresponding association is in the diagram. // if efobject is an entity-set, Return true only if all the entity-types contained in the set are represented in the diagram.
None
efObject
EFObject
None