src/Misc/EFTools/EntityDesignPackage/CustomCode/MicrosoftDataEntityDesignCommandSet.cs
/// <summary>
///     Determine whether to show Property Move menu items or not
///     We only show menu items if:
///     - All the selected properties belong to a single entity.
///     AND
///     - All the selected properties are either Property (includes: ScalarProperty and ComplexProperty) or NavigationProperty.
/// </summary>
Determine whether to show Property Move menu items or not
We only show menu items if:
All the selected properties belong to a single entity.
AND
All the selected properties are either Property (includes: ScalarProperty and ComplexProperty) or NavigationProperty.
Determine whether to show Property Move menu items or not We only show menu items if : All the selected properties belong to a single entity . AND All the selected properties are either Property ( includes : ScalarProperty and ComplexProperty ) or NavigationProperty .
internal void OnStatusPropertyMove(object sender, EventArgs e)
        {
            var cmd = sender as MenuCommand;
            if (null != cmd)
            {
                cmd.Enabled = cmd.Visible = false;
                var diagram = GetDiagram();
                if (diagram != null)
                {
                    var properties = CurrentSelection.OfType<PropertyBase>().ToList();
                    if (CurrentSelection.Count == properties.Count
                        && properties.Count > 0)
                    {
                        var propertyTypes = new HashSet<Type>();
                        var entityTypes = new HashSet<EntityType>();
                        foreach (var property in properties)
                        {
                            var navProp = property as NavigationProperty;
                            var prop = property as Property;
                            if (navProp != null)
                            {
                                propertyTypes.Add(typeof(NavigationProperty));
                                entityTypes.Add(navProp.EntityType);
                            }
                            if (prop != null)
                            {
                                propertyTypes.Add(typeof(Property));
                                entityTypes.Add(prop.EntityType);
                            }
                        }
                        cmd.Enabled = cmd.Visible = (propertyTypes.Count == 1 && entityTypes.Count == 1);
                    }
                }
            }
        }
internal void OnStatusPropertyMove ( object sender , EventArgs e ) { var cmd = sender as MenuCommand ; if ( null != cmd ) { cmd . Enabled = cmd . Visible = false ; var diagram = GetDiagram ( ) ; if ( diagram != null ) { var properties = CurrentSelection . OfType < PropertyBase > ( ) . ToList ( ) ; if ( CurrentSelection . Count == properties . Count && properties . Count > 0 ) { var propertyTypes = new HashSet < Type > ( ) ; var entityTypes = new HashSet < EntityType > ( ) ; foreach ( var property in properties ) { var navProp = property as NavigationProperty ; var prop = property as Property ; if ( navProp != null ) { propertyTypes . Add ( typeof ( NavigationProperty ) ) ; entityTypes . Add ( navProp . EntityType ) ; } if ( prop != null ) { propertyTypes . Add ( typeof ( Property ) ) ; entityTypes . Add ( prop . EntityType ) ; } } cmd . Enabled = cmd . Visible = ( propertyTypes . Count == 1 && entityTypes . Count == 1 ) ; } } } }
Determine whether to show Property Move menu items or not
We only show menu items if:
 All the selected properties belong to a single entity.
Determine whether to show Property Move menu items or not We only show menu items if : All the selected properties belong to a single entity .
// Check if all the selected items are properties.
sender
object
e
EventArgs