Пример #1
0
        private static bool ReadyForFurtherValidation(ReferentialConstraintRoleElement role)
        {
            if (role == null)
            {
                return(false);
            }

            if (role.End == null)
            {
                return(false);
            }

            if (role.RoleProperties.Count == 0)
            {
                return(false);
            }

            foreach (var propRef in role.RoleProperties)
            {
                if (propRef.Property == null)
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #2
0
        // <summary>
        // Resolves the given property names to the property in the item
        // Also checks whether the properties form the key for the given type and whether all the properties are nullable or not
        // </summary>
        private static void IsKeyProperty(
            ReferentialConstraintRoleElement roleElement, SchemaEntityType itemType,
            out bool isKeyProperty,
            out bool areAllPropertiesNullable,
            out bool isAnyPropertyNullable,
            out bool isSubsetOfKeyProperties)
        {
            isKeyProperty            = true;
            areAllPropertiesNullable = true;
            isAnyPropertyNullable    = false;
            isSubsetOfKeyProperties  = true;

            if (itemType.KeyProperties.Count
                != roleElement.RoleProperties.Count)
            {
                isKeyProperty = false;
            }

            // Checking that ToProperties must be the key properties in the entity type referred by the ToRole
            for (var i = 0; i < roleElement.RoleProperties.Count; i++)
            {
                // Once we find that the properties in the constraint are not a subset of the
                // Key, one need not search for it every time
                if (isSubsetOfKeyProperties)
                {
                    var foundKeyProperty = false;

                    // All properties that are defined in ToProperties must be the key property on the entity type
                    for (var j = 0; j < itemType.KeyProperties.Count; j++)
                    {
                        if (itemType.KeyProperties[j].Property
                            == roleElement.RoleProperties[i].Property)
                        {
                            foundKeyProperty = true;
                            break;
                        }
                    }

                    if (!foundKeyProperty)
                    {
                        isKeyProperty           = false;
                        isSubsetOfKeyProperties = false;
                    }
                }

                areAllPropertiesNullable &= roleElement.RoleProperties[i].Property.Nullable;
                isAnyPropertyNullable    |= roleElement.RoleProperties[i].Property.Nullable;
            }
        }
Пример #3
0
 private static bool ReadyForFurtherValidation(ReferentialConstraintRoleElement role)
 {
     if (role == null || role.End == null || role.RoleProperties.Count == 0)
     {
         return(false);
     }
     foreach (PropertyRefElement roleProperty in (IEnumerable <PropertyRefElement>)role.RoleProperties)
     {
         if (roleProperty.Property == null)
         {
             return(false);
         }
     }
     return(true);
 }
Пример #4
0
 private static void IsKeyProperty(
     ReferentialConstraintRoleElement roleElement,
     SchemaEntityType itemType,
     out bool isKeyProperty,
     out bool areAllPropertiesNullable,
     out bool isAnyPropertyNullable,
     out bool isSubsetOfKeyProperties)
 {
     isKeyProperty            = true;
     areAllPropertiesNullable = true;
     isAnyPropertyNullable    = false;
     isSubsetOfKeyProperties  = true;
     if (itemType.KeyProperties.Count != roleElement.RoleProperties.Count)
     {
         isKeyProperty = false;
     }
     for (int index1 = 0; index1 < roleElement.RoleProperties.Count; ++index1)
     {
         if (isSubsetOfKeyProperties)
         {
             bool flag = false;
             for (int index2 = 0; index2 < itemType.KeyProperties.Count; ++index2)
             {
                 if (itemType.KeyProperties[index2].Property == roleElement.RoleProperties[index1].Property)
                 {
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 isKeyProperty           = false;
                 isSubsetOfKeyProperties = false;
             }
         }
         areAllPropertiesNullable &= roleElement.RoleProperties[index1].Property.Nullable;
         isAnyPropertyNullable    |= roleElement.RoleProperties[index1].Property.Nullable;
     }
 }
 internal void HandleReferentialConstraintDependentRoleElement(XmlReader reader)
 {
     _dependentRole = new ReferentialConstraintRoleElement(this);
     _dependentRole.Parse(reader);
 }
 internal void HandleReferentialConstraintPrincipalRoleElement(XmlReader reader)
 {
     _principalRole = new ReferentialConstraintRoleElement(this);
     _principalRole.Parse(reader);
 }
        /// <summary>
        ///     Resolves the given property names to the property in the item
        ///     Also checks whether the properties form the key for the given type and whether all the properties are nullable or not
        /// </summary>
        /// <param name="roleElement"> </param>
        /// <param name="itemType"> </param>
        /// <param name="isKeyProperty"> </param>
        /// <param name="areAllPropertiesNullable"> </param>
        /// <param name="isSubsetOfKeyProperties"> </param>
        private static void IsKeyProperty(
            ReferentialConstraintRoleElement roleElement, SchemaEntityType itemType,
            out bool isKeyProperty,
            out bool areAllPropertiesNullable,
            out bool isAnyPropertyNullable,
            out bool isSubsetOfKeyProperties)
        {
            isKeyProperty = true;
            areAllPropertiesNullable = true;
            isAnyPropertyNullable = false;
            isSubsetOfKeyProperties = true;

            if (itemType.KeyProperties.Count
                != roleElement.RoleProperties.Count)
            {
                isKeyProperty = false;
            }

            // Checking that ToProperties must be the key properties in the entity type referred by the ToRole
            for (var i = 0; i < roleElement.RoleProperties.Count; i++)
            {
                // Once we find that the properties in the constraint are not a subset of the
                // Key, one need not search for it every time
                if (isSubsetOfKeyProperties)
                {
                    var foundKeyProperty = false;

                    // All properties that are defined in ToProperties must be the key property on the entity type
                    for (var j = 0; j < itemType.KeyProperties.Count; j++)
                    {
                        if (itemType.KeyProperties[j].Property
                            == roleElement.RoleProperties[i].Property)
                        {
                            foundKeyProperty = true;
                            break;
                        }
                    }

                    if (!foundKeyProperty)
                    {
                        isKeyProperty = false;
                        isSubsetOfKeyProperties = false;
                    }
                }

                areAllPropertiesNullable &= roleElement.RoleProperties[i].Property.Nullable;
                isAnyPropertyNullable |= roleElement.RoleProperties[i].Property.Nullable;
            }
        }
        private static bool ReadyForFurtherValidation(ReferentialConstraintRoleElement role)
        {
            if (role == null)
            {
                return false;
            }

            if (role.End == null)
            {
                return false;
            }

            if (role.RoleProperties.Count == 0)
            {
                return false;
            }

            foreach (var propRef in role.RoleProperties)
            {
                if (propRef.Property == null)
                {
                    return false;
                }
            }

            return true;
        }
Пример #9
0
 internal void HandleReferentialConstraintDependentRoleElement(XmlReader reader)
 {
     this._dependentRole = new ReferentialConstraintRoleElement(this);
     this._dependentRole.Parse(reader);
 }
Пример #10
0
 internal void HandleReferentialConstraintPrincipalRoleElement(XmlReader reader)
 {
     this._principalRole = new ReferentialConstraintRoleElement(this);
     this._principalRole.Parse(reader);
 }