Exemplo n.º 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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
 public static bool IsCriteriaClass(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.CriteriaClass);
 }
Exemplo n.º 4
0
 public static bool IsNotUnitOfWork(this CslaObjectType cslaType)
 {
     return(!cslaType.IsUnitOfWork());
 }
Exemplo n.º 5
0
 public static bool IsNotEditableRoot(this CslaObjectType cslaType)
 {
     return(!cslaType.IsEditableRoot());
 }
Exemplo n.º 6
0
 private string GetTemplateName(CslaObjectType type)
 {
     return(String.Format("{0}.cst", type.ToString()));
 }
Exemplo n.º 7
0
 public static bool IsNotPlaceHolder(this CslaObjectType cslaType)
 {
     return(!cslaType.IsPlaceHolder());
 }
Exemplo n.º 8
0
 public static bool IsNotBaseClass(this CslaObjectType cslaType)
 {
     return(!cslaType.IsBaseClass());
 }
Exemplo n.º 9
0
 public static bool IsReadOnlyObject(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.ReadOnlyObject);
 }
Exemplo n.º 10
0
 public static bool IsNotEditableChildCollection(this CslaObjectType cslaType)
 {
     return(!cslaType.IsEditableChildCollection());
 }
Exemplo n.º 11
0
 public static bool IsEditableChildCollection(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.EditableChildCollection);
 }
Exemplo n.º 12
0
 public static bool IsNotDynamicEditableRootCollection(this CslaObjectType cslaType)
 {
     return(!cslaType.IsDynamicEditableRootCollection());
 }
Exemplo n.º 13
0
 public static bool IsDynamicEditableRootCollection(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.DynamicEditableRootCollection);
 }
Exemplo n.º 14
0
 public static bool IsNotEditableSwitchable(this CslaObjectType cslaType)
 {
     return(!cslaType.IsEditableSwitchable());
 }
Exemplo n.º 15
0
 public static bool IsEditableSwitchable(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.EditableSwitchable);
 }
Exemplo n.º 16
0
 public static bool IsNotCriteriaClass(this CslaObjectType cslaType)
 {
     return(!cslaType.IsCriteriaClass());
 }
Exemplo n.º 17
0
 public static bool IsBaseClass(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.BaseClass);
 }
Exemplo n.º 18
0
 public static bool IsReadOnlyCollection(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.ReadOnlyCollection);
 }
Exemplo n.º 19
0
 public static bool IsPlaceHolder(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.PlaceHolder);
 }
Exemplo n.º 20
0
 public static bool IsNotReadOnlyCollection(this CslaObjectType cslaType)
 {
     return(!cslaType.IsReadOnlyCollection());
 }
Exemplo n.º 21
0
 public static bool IsNameValueList(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.NameValueList);
 }
Exemplo n.º 22
0
 public static bool IsNotNameValueList(this CslaObjectType cslaType)
 {
     return(!cslaType.IsNameValueList());
 }
Exemplo n.º 23
0
 private void NewCollection(CslaObjectType type, string name, string item)
 {
     NewCollection(type, name, item, String.Empty);
 }
Exemplo n.º 24
0
 public static bool IsUnitOfWork(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.UnitOfWork);
 }
Exemplo n.º 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;
 }
Exemplo n.º 26
0
 public static bool IsEditableRoot(this CslaObjectType cslaType)
 {
     return(cslaType == CslaObjectType.EditableRoot);
 }