/// <summary>
        /// Initializes a new instance of the <see cref="MultiCrossReferenceDefinition"/> class.
        /// </summary>
        /// <param name="manyTable1">The many table1.</param>
        /// <param name="keyTable1">The key table1.</param>
        /// <param name="manyTable2">The many table2.</param>
        /// <param name="keyTable2">The key table2.</param>
        /// <param name="joinTableName">Name of the join table.</param>
        /// <param name="showFieldList">The show field list.</param>
        /// <param name="baseTables">The base tables.</param>
        public MultiCrossReferenceDefinition(TableDefinition manyTable1, string keyTable1, TableDefinition manyTable2, string keyTable2, string joinTableName, IList<string> showFieldList, params TableDefinition[] baseTables)
        {
            if (manyTable1 != null)
                _manyTable1Name = manyTable1.Name;

            JoinTable = new TableDefinition(joinTableName);
            JoinTable.AddField(keyTable1, ColumnTypes.Integer);
            JoinTable.AddField(keyTable2, ColumnTypes.Integer);
            CrossRef1 = new SingleCrossReferenceDefinition(JoinTable, manyTable1, keyTable1, "alias1");
            CrossRef2 = new SingleCrossReferenceDefinition(JoinTable, manyTable2, keyTable2, "alias2");
            ShowFieldList = showFieldList;

            var list = new List<TableDefinition>();

            if (baseTables != null)
                for (var index = 0; index < baseTables.Length; index++)
                {
                    var tbl = baseTables[index];
                    if (manyTable2 == null || string.Equals(manyTable2.Name, tbl.Name))
                        continue;

                    var newTableDef = new TableDefinition(tbl.Name) { Prefix = manyTable2.Name + string.Format(CultureInfo.InvariantCulture, "_b{0}", index) };
                    foreach (var field in tbl.GetFields())
                        newTableDef.AddField(field.SystemName, field.ColumnType);

                    list.Add(newTableDef);
                }

            BaseTables = list;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SingleCrossReferenceDefinition"/> class.
        /// </summary>
        /// <param name="oneTable">The one table.</param>
        /// <param name="manyTable">The many table.</param>
        /// <param name="keyField">The key field.</param>
        /// <param name="showFieldList">The show field list.</param>
        /// <param name="alias">The alias.</param>
        /// <param name="baseTables">The base tables.</param>
        public SingleCrossReferenceDefinition(TableDefinition oneTable, TableDefinition manyTable, string keyField, string[] showFieldList, string alias, params TableDefinition[] baseTables)
            : this(oneTable, manyTable, keyField, alias)
        {
            ShowFieldList = showFieldList;

            var list = new List<TableDefinition>();
            if (baseTables != null)
                foreach (var tbl in baseTables)
                {
                    if (oneTable != null && string.Equals(oneTable.Name, tbl.Name))
                        continue;

                    var newTableDef = new TableDefinition(tbl.Name);
                    foreach (var field in tbl.GetFields())
                        newTableDef.AddField(field.SystemName, field.ColumnType);
                    list.Add(newTableDef);
                }

            BaseTables = list.ToArray();
        }