Example #1
0
        public static bool IsCollectionType(this CslaObjectType cslaType)
        {
            if (cslaType.IsEditableRootCollection() ||
                cslaType.IsEditableChildCollection() ||
                cslaType.IsDynamicEditableRootCollection() ||
                cslaType.IsReadOnlyCollection())
            {
                return(true);
            }

            return(false);
        }
        // ParentType1 - root stereotypes can't have parent
        private static bool CanHaveParent(CslaObjectType child)
        {
            _specificErrorMessage = "A Root stereotype cannot have a parent.";

            if (child.IsEditableRoot() ||
                child.IsEditableRootCollection() ||
                child.IsDynamicEditableRootCollection())
            {
                BrokenRuleMsg  = "\r\nRelation rule: " + _specificErrorMessage + " * * *\r\n";
                BrokenRuleMsg += child + " cannot have a ParentType.";
                return(false);
            }

            return(true);
        }
Example #3
0
        public static bool IsEditableType(this CslaObjectType cslaType)
        {
            if (cslaType.IsEditableChild() ||
                cslaType.IsEditableChildCollection() ||
                cslaType.IsEditableRoot() ||
                cslaType.IsEditableRootCollection() ||
                cslaType.IsEditableSwitchable() ||
                cslaType.IsDynamicEditableRoot() ||
                cslaType.IsDynamicEditableRootCollection())
            {
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Determines whether the specified <paramref name="stereotype"/> is allowed to have no parent.
        /// </summary>
        /// <param name="stereotype">The candidate stereotype.</param>
        /// <returns>
        ///     <c>true</c> if the specified <paramref name="stereotype"/> is allowed to have no parent; otherwise, <c>false</c>.
        /// </returns>
        /// <remarks>This is "ParentType1" - root stereotypes don't have a parent.</remarks>
        public static bool IsNoParentAllowed(CslaObjectType stereotype)
        {
            _specificErrorMessage = string.Empty;
            BrokenRuleMsg         = string.Empty;

            if (stereotype.IsEditableRoot() ||
                stereotype.IsEditableRootCollection() ||
                stereotype.IsDynamicEditableRootCollection() ||
                stereotype.IsReadOnlyObject() ||
                stereotype.IsReadOnlyCollection() ||
                stereotype.IsBaseClass() ||
                stereotype.IsCriteriaClass())
            {
                return(true);
            }

            BrokenRuleMsg = stereotype + " must have a ParentType.";
            return(false);
        }
Example #5
0
 public static bool IsNotDynamicEditableRootCollection(this CslaObjectType cslaType)
 {
     return(!cslaType.IsDynamicEditableRootCollection());
 }