src/Misc/EFTools/EntityDesign/UI/Views/Dialogs/NewAssociationDialog.cs
// <summary>
//     Attempts to determing the principal and dependent ends. Can return null for principal/dependent values.
// </summary>
Attempts to determing the principal and dependent ends. Can return null for principal/dependent values.
Attempts to determing the principal and dependent ends . Can return null for principal / dependent values .
private void TryGetPrincipalAndDependentEntities(out EntityType principal, out EntityType dependent)
        {
            principal = null;
            dependent = null;
            if (string.Equals(End1MultiplicityText, Resources.PropertyWindow_Value_MultiplicityOne, StringComparison.CurrentCulture)
                && string.Equals(End2MultiplicityText, Resources.PropertyWindow_Value_MultiplicityOne, StringComparison.CurrentCulture))
            {
                dependent = End2Entity;
                principal = End1Entity;
            }
            else if (string.Equals(
                End1MultiplicityText, Resources.PropertyWindow_Value_MultiplicityZeroOrOne, StringComparison.CurrentCulture)
                     && string.Equals(
                         End2MultiplicityText, Resources.PropertyWindow_Value_MultiplicityZeroOrOne, StringComparison.CurrentCulture))
            {
                dependent = End2Entity;
                principal = End1Entity;
            }
            else if (string.Equals(
                End1MultiplicityText, Resources.PropertyWindow_Value_MultiplicityZeroOrOne, StringComparison.CurrentCulture)
                     && string.Equals(
                         End2MultiplicityText, Resources.PropertyWindow_Value_MultiplicityMany, StringComparison.CurrentCulture))
            {
                dependent = End2Entity;
                principal = End1Entity;
            }
            else if (string.Equals(
                End2MultiplicityText, Resources.PropertyWindow_Value_MultiplicityZeroOrOne, StringComparison.CurrentCulture)
                     && string.Equals(
                         End1MultiplicityText, Resources.PropertyWindow_Value_MultiplicityMany, StringComparison.CurrentCulture))
            {
                dependent = End1Entity;
                principal = End2Entity;
            }
            else
            {
                if (string.Equals(
                    End1MultiplicityText, Resources.PropertyWindow_Value_MultiplicityOne, StringComparison.CurrentCulture)
                    && (string.Equals(
                        End2MultiplicityText, Resources.PropertyWindow_Value_MultiplicityZeroOrOne, StringComparison.CurrentCulture)
                        || string.Equals(
                            End2MultiplicityText, Resources.PropertyWindow_Value_MultiplicityMany, StringComparison.CurrentCulture)))
                {
                    dependent = End2Entity;
                    principal = End1Entity;
                }
                else if (string.Equals(
                    End2MultiplicityText, Resources.PropertyWindow_Value_MultiplicityOne, StringComparison.CurrentCulture)
                         && (string.Equals(
                             End1MultiplicityText, Resources.PropertyWindow_Value_MultiplicityZeroOrOne, StringComparison.CurrentCulture)
                             ||
                             string.Equals(
                                 End1MultiplicityText, Resources.PropertyWindow_Value_MultiplicityMany, StringComparison.CurrentCulture)))
                {
                    dependent = End1Entity;
                    principal = End2Entity;
                }
            }
        }
private void TryGetPrincipalAndDependentEntities ( out EntityType principal , out EntityType dependent ) { principal = null ; dependent = null ; if ( string . Equals ( End1MultiplicityText , Resources . PropertyWindow_Value_MultiplicityOne , StringComparison . CurrentCulture ) && string . Equals ( End2MultiplicityText , Resources . PropertyWindow_Value_MultiplicityOne , StringComparison . CurrentCulture ) ) { dependent = End2Entity ; principal = End1Entity ; } else if ( string . Equals ( End1MultiplicityText , Resources . PropertyWindow_Value_MultiplicityZeroOrOne , StringComparison . CurrentCulture ) && string . Equals ( End2MultiplicityText , Resources . PropertyWindow_Value_MultiplicityZeroOrOne , StringComparison . CurrentCulture ) ) { dependent = End2Entity ; principal = End1Entity ; } else if ( string . Equals ( End1MultiplicityText , Resources . PropertyWindow_Value_MultiplicityZeroOrOne , StringComparison . CurrentCulture ) && string . Equals ( End2MultiplicityText , Resources . PropertyWindow_Value_MultiplicityMany , StringComparison . CurrentCulture ) ) { dependent = End2Entity ; principal = End1Entity ; } else if ( string . Equals ( End2MultiplicityText , Resources . PropertyWindow_Value_MultiplicityZeroOrOne , StringComparison . CurrentCulture ) && string . Equals ( End1MultiplicityText , Resources . PropertyWindow_Value_MultiplicityMany , StringComparison . CurrentCulture ) ) { dependent = End1Entity ; principal = End2Entity ; } else { if ( string . Equals ( End1MultiplicityText , Resources . PropertyWindow_Value_MultiplicityOne , StringComparison . CurrentCulture ) && ( string . Equals ( End2MultiplicityText , Resources . PropertyWindow_Value_MultiplicityZeroOrOne , StringComparison . CurrentCulture ) || string . Equals ( End2MultiplicityText , Resources . PropertyWindow_Value_MultiplicityMany , StringComparison . CurrentCulture ) ) ) { dependent = End2Entity ; principal = End1Entity ; } else if ( string . Equals ( End2MultiplicityText , Resources . PropertyWindow_Value_MultiplicityOne , StringComparison . CurrentCulture ) && ( string . Equals ( End1MultiplicityText , Resources . PropertyWindow_Value_MultiplicityZeroOrOne , StringComparison . CurrentCulture ) || string . Equals ( End1MultiplicityText , Resources . PropertyWindow_Value_MultiplicityMany , StringComparison . CurrentCulture ) ) ) { dependent = End1Entity ; principal = End2Entity ; } } }
Attempts to determing the principal and dependent ends.
Attempts to determing the principal and dependent ends .
// NOTE: this needs to match the logic in ModelHelper.DeterminePrincipalDependentAssociationEnds() // End1 Multiplicity | End2 Multiplicity | Principal Role // 1                 | 1                 | just pick end1 // End1 Multiplicity | End2 Multiplicity | Principal Role // 0..1              | 0..1              | just pick end1 // End1 Multiplicity | End2 Multiplicity | Principal Role // 0..1              | *                 | 0..1 // End1 Multiplicity | End2 Multiplicity | Principal Role // *                 | 0..1              | 0..1 // End1 Multiplicity | End2 Multiplicity | Principal Role // 1                 | 0..1              | 1 // 1                 | *                 | 1 // End1 Multiplicity | End2 Multiplicity | Principal Role // 0..1              | 1                 | 1 // *                 | 1                 | 1
EntityType
out