예제 #1
0
        /// <summary>
        /// Link table
        /// 关联表
        /// </summary>

        /// <param name="IncludeColumnName">包含列 include field</param>
        /// <param name="ExcludeColumnName">排除列 exclude field</param>
        /// <param name="ForeignTable">外联表名</param>
        /// <param name="LocalField">关联字段</param>
        /// <param name="ForeignField">外联字段</param>
        /// <param name="ForeignName">外联集合名</param>
        /// <returns></returns>
        public IHashTable TableLink(List <String> IncludeColumnName, List <String> ExcludeColumnName, String ForeignTable, String LocalField,
                                    String ForeignField, String ForeignName)
        {
            if (filterDefinition == null)
            {
                throw new Exception("filter cannot null");
            }

            //数据库连接
            if (_connectionConfig.IsAutoCloseConnection == false)
            {
                if (_database.CheckStatus() == false)
                {
                    throw new Exception("databse connect not open");
                }
            }
            if (_connectionConfig.IsAutoCloseConnection == true)
            {
                _database.Open();
            }
            List <Hashtable> hr = _database.TableLink(_databasename, _TableName,
                                                      filterDefinition, IncludeColumnName, ExcludeColumnName
                                                      , ForeignTable, LocalField, ForeignField, ForeignName);

            if (_connectionConfig.IsAutoCloseConnection == true)
            {
                _database.Close();
            }

            IHashTable DT = new IHashTable(hr);

            return(DT);
        }