Пример #1
0
        protected internal virtual string GetSqlScriptPkString(bool withAsDcl = false)
        {
            var colData = IdAsSimpleProperties.SelectMany(x => GetColumnDataByPropertyName(x.Key));

            if (!withAsDcl)
            {
                return(string.Join(", ", colData.Select(x => x.GetDbColumnName())));
            }

            var ssqlPk = new List <string>();

            foreach (var ids in colData)
            {
                ssqlPk.Add($"{ids.GetDbColumnName()} {ids.data_type.ToUpper()}");
            }
            return(string.Join(", ", ssqlPk));
        }
Пример #2
0
        /// <summary>
        /// Intended for the creation of a SortedList of this type.
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public int CompareTo(HbmFileContent other)
        {
            const int THIS_COMES_BEFORE_OTHER = -1;
            const int THIS_EQUALS_OTHER       = 0;
            const int OTHER_COMES_BEFORE_THIS = 1;

            if (other == null)
            {
                return(THIS_COMES_BEFORE_OTHER);
            }

            var myName    = AssemblyQualifiedTypeName;
            var otherName = other.AssemblyQualifiedTypeName;

            if (otherName == myName)
            {
                return(THIS_EQUALS_OTHER);
            }
            if (IsCompositeKey && CompositeKeyProperties != null && CompositeKeyProperties.ContainsValue(otherName))
            {
                return(OTHER_COMES_BEFORE_THIS);
            }
            if (IdAsSimpleProperties != null && IdAsSimpleProperties.ContainsValue(otherName))
            {
                return(OTHER_COMES_BEFORE_THIS);
            }

            if (FkProperties != null && FkProperties.ContainsValue(otherName))
            {
                return(OTHER_COMES_BEFORE_THIS);
            }

            if (ListProperties != null && ListProperties.ContainsKey(otherName))
            {
                return(THIS_COMES_BEFORE_OTHER);
            }

            return(THIS_EQUALS_OTHER);
        }