Exemplo n.º 1
0
        /// <summary>
        /// Returns true if the given (possibly incomplete) identifier definition equals this.
        ///
        /// For example, "table.column".EqualsByName("column") is true.
        /// </summary>
        /// <param name="identifierDefinition"></param>
        /// <returns></returns>
        public bool EqualsByName(string identifierDefinition)
        {
            var IsEqual = string.Compare(identifierDefinition, this.Name, StringComparison.InvariantCultureIgnoreCase) == 0 ||
                          string.Compare(identifierDefinition, this.PrefixAndName, StringComparison.InvariantCultureIgnoreCase) == 0 ||
                          string.Compare(identifierDefinition, this.Definition, StringComparison.InvariantCultureIgnoreCase) == 0 ||
                          string.Compare(identifierDefinition, this.ToString(), StringComparison.InvariantCultureIgnoreCase) == 0;

            if (IsEqual == false)
            {
                // Try again, using identifier name only... no prefix or alias.
                var identifierNameOnly = ColumnValue.GetNameOnly(identifierDefinition);
                IsEqual = string.Compare(identifierNameOnly, this.Name, StringComparison.InvariantCultureIgnoreCase) == 0 ||
                          string.Compare(identifierNameOnly, this.PrefixAndName, StringComparison.InvariantCultureIgnoreCase) == 0 ||
                          string.Compare(identifierNameOnly, this.Definition, StringComparison.InvariantCultureIgnoreCase) == 0 ||
                          string.Compare(identifierNameOnly, this.ToString(), StringComparison.InvariantCultureIgnoreCase) == 0;
            }

            return(IsEqual);
        }