Ejemplo n.º 1
0
        private static bool OwningClassHasPrimaryKey(IRelationshipDef relationshipDef, IClassDef classDef, ClassDefCol classDefCol)
        {
            //For each Property in the Relationship Key check if it is defined as the primary key for the
            //class if it is then check the other properties else this is not a primaryKey
            var primaryKeyDef = ClassDefHelper.GetPrimaryKeyDef(classDef, classDefCol);

            foreach (var relPropDef in relationshipDef.RelKeyDef)
            {
                var isInKeyDef = false;
                foreach (IPropDef propDef in primaryKeyDef)
                {
                    if (propDef.PropertyName != relPropDef.OwnerPropertyName)
                    {
                        isInKeyDef = false;
                        break;
                    }
                    isInKeyDef = true;
                }
                if (!isInKeyDef)
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
        public string GetHeading(IClassDef classDef)
        {
            //If the heading is overriden specifically for this UIGridColumn
            // i.e. it is not derived from the DisplayName of the
            // PropDef then use it.
            if (!String.IsNullOrEmpty(Heading))
            {
                return(Heading);
            }
            //Else use the PropDefs Display name
            IPropDef propDef = ClassDefHelper.GetPropDefByPropName(classDef, PropertyName);

            if (propDef != null)
            {
                return(propDef.DisplayName);
            }
            //Else use a Delimited Prop Name i.e. "FirstName" -> "First Name"
            return(StringUtilities.DelimitPascalCase(_propertyName, " "));
        }
Ejemplo n.º 3
0
        ///// <summary>
        ///// Returns the collection of triggers managed by this
        ///// field
        ///// </summary>
        //public ITriggerCol Triggers
        //{
        //    get { return _triggers; }
        //}

        #endregion

        #region Helper Methods

        ///<summary>
        /// Gets the property definition for the property that this field refers to.
        /// This property could be on a related object. If the property is not found, then
        /// nul is returned.
        ///</summary>
        ///<param name="classDef">The class definition that this field is for.</param>
        ///<returns>The property definition that is refered to, otherwise null. </returns>
        public IPropDef GetPropDefIfExists(IClassDef classDef)
        {
            return(ClassDefHelper.GetPropDefByPropName(classDef, PropertyName));
        }