Example #1
0
        /// <summary>
        /// Determines whether <paramref name="parent"/> can have the specified <paramref name="child"/>.
        /// </summary>
        /// <param name="parent">The parent candidate.</param>
        /// <param name="child">The child candidate.</param>
        /// <returns>
        ///     <c>true</c> if <paramref name="parent"/> can have the specified <paramref name="child"/>; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsChildAllowed(CslaObjectType parent, CslaObjectType child)
        {
            _specificErrorMessage = string.Empty;
            BrokenRuleMsg         = string.Empty;

            bool?result;

            ChildType1_LoadData();
            result = ChildType(parent, child);
            if (result != null)
            {
                return(result == true);
            }

            ChildType2_LoadData();
            result = ChildType(parent, child);
            if (result != null)
            {
                return(result == true);
            }

            ChildType3_LoadData();
            result = ChildType(parent, child);
            if (result != null)
            {
                return(result == true);
            }

            ChildType4_LoadData();
            result = ChildType(parent, child);
            if (result != null)
            {
                return(result == true);
            }

            ChildType5_LoadData();
            result = ChildType(parent, child);
            if (result != null)
            {
                return(result == 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 #3
0
 public static bool IsCriteriaClass(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.CriteriaClass);
 }
Example #4
0
 public static bool IsNotUnitOfWork(this CslaObjectType cslaType)
 {
     return(!cslaType.IsUnitOfWork());
 }
Example #5
0
 public static bool IsNotEditableRoot(this CslaObjectType cslaType)
 {
     return(!cslaType.IsEditableRoot());
 }
Example #6
0
 private string GetTemplateName(CslaObjectType type)
 {
     return(String.Format("{0}.cst", type.ToString()));
 }
Example #7
0
 public static bool IsNotPlaceHolder(this CslaObjectType cslaType)
 {
     return(!cslaType.IsPlaceHolder());
 }
Example #8
0
 public static bool IsNotBaseClass(this CslaObjectType cslaType)
 {
     return(!cslaType.IsBaseClass());
 }
Example #9
0
 public static bool IsReadOnlyObject(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.ReadOnlyObject);
 }
Example #10
0
 public static bool IsNotEditableChildCollection(this CslaObjectType cslaType)
 {
     return(!cslaType.IsEditableChildCollection());
 }
Example #11
0
 public static bool IsEditableChildCollection(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.EditableChildCollection);
 }
Example #12
0
 public static bool IsNotDynamicEditableRootCollection(this CslaObjectType cslaType)
 {
     return(!cslaType.IsDynamicEditableRootCollection());
 }
Example #13
0
 public static bool IsDynamicEditableRootCollection(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.DynamicEditableRootCollection);
 }
Example #14
0
 public static bool IsNotEditableSwitchable(this CslaObjectType cslaType)
 {
     return(!cslaType.IsEditableSwitchable());
 }
Example #15
0
 public static bool IsEditableSwitchable(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.EditableSwitchable);
 }
Example #16
0
 public static bool IsNotCriteriaClass(this CslaObjectType cslaType)
 {
     return(!cslaType.IsCriteriaClass());
 }
Example #17
0
 public static bool IsBaseClass(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.BaseClass);
 }
Example #18
0
 public static bool IsReadOnlyCollection(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.ReadOnlyCollection);
 }
Example #19
0
 public static bool IsPlaceHolder(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.PlaceHolder);
 }
Example #20
0
 public static bool IsNotReadOnlyCollection(this CslaObjectType cslaType)
 {
     return(!cslaType.IsReadOnlyCollection());
 }
Example #21
0
 public static bool IsNameValueList(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.NameValueList);
 }
Example #22
0
 public static bool IsNotNameValueList(this CslaObjectType cslaType)
 {
     return(!cslaType.IsNameValueList());
 }
Example #23
0
 private void NewCollection(CslaObjectType type, string name, string item)
 {
     NewCollection(type, name, item, String.Empty);
 }
Example #24
0
 public static bool IsUnitOfWork(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.UnitOfWork);
 }
Example #25
0
 /// <summary>
 /// Initializes a new instance of the ObjectFactory class.
 /// </summary>
 /// <param name="currentUnit"></param>
 /// <param name="type"></param>
 public ObjectFactory(CslaGeneratorUnit currentUnit, CslaObjectType type)
 {
     _currentUnit                  = currentUnit;
     _currentCslaObject            = new CslaObjectInfo(_currentUnit);
     _currentCslaObject.ObjectType = type;
 }
Example #26
0
 public static bool IsEditableRoot(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.EditableRoot);
 }