Inheritance: IPreparable, ISerializable
示例#1
0
        /// <summary>
        /// Adds a table as source to the query with a given alias.
        /// </summary>
        /// <param name="alias">The unique name alias of the table source within the clause.</param>
        /// <param name="table">The table source object to query from.</param>
        public void AddTable(string alias, FromTable table)
        {
            if (table == null)
            {
                throw new ArgumentNullException("table");
            }

            if (!String.IsNullOrEmpty(alias))
            {
                if (tableNames.Contains(alias))
                {
                    throw new ArgumentException(String.Format("Duplicated table name {0} is FROM clause.", alias));
                }

                tableNames.Add(alias);
            }

            // Create a new unique key for this table
            string key = CreateNewKey();

            table.UniqueKey = key;
            fromTables.Add(table);
        }
示例#2
0
        /// <summary>
        /// Adds a table as source to the query with a given alias.
        /// </summary>
        /// <param name="alias">The unique name alias of the table source within the clause.</param>
        /// <param name="table">The table source object to query from.</param>
        public void AddTable(string alias, FromTable table)
        {
            if (table == null)
                throw new ArgumentNullException("table");

            if (!String.IsNullOrEmpty(alias)) {
                if (tableNames.Contains(alias))
                    throw new ArgumentException(String.Format("Duplicated table name {0} is FROM clause.", alias));

                tableNames.Add(alias);
            }

            // Create a new unique key for this table
            string key = CreateNewKey();
            table.UniqueKey = key;
            fromTables.Add(table);
        }