/// <summary>
        /// Generates the detail tables definition based on the master-detail data of the model, getting the detail foreign keys as well.
        /// </summary>
        private void GenerateDetailModelsForItemTemplates()
        {
            if (DetailForeignKeys != null)
            {
                DetailForeignKeys.Clear();
            }

            _detailTable = _detailEntity;
            if (string.IsNullOrEmpty(_detailTable))
            {
                return;
            }

            _detailColumns = BaseWizard <BaseWizardForm, WindowsFormsCodeGeneratorStrategy> .GetColumnsFromTable(_detailTable, _connection);

            ItemTemplateUtilities.RetrieveAllFkInfo(_connection, _detailTable, out DetailForeignKeys);
            _colValidationsDetail = ValidationsGrid.GetColumnValidationList(_detailTable, _detailColumns, DetailForeignKeys);
        }
        /// <summary>
        /// Generates the tables and columns based on the model information. Also, it gets the foreign keys data.
        /// </summary>
        private void GenerateModelsForItemTemplates()
        {
            if (_columns == null || _columns.Count == 0)
            {
                if (ForeignKeys != null)
                {
                    ForeignKeys.Clear();
                }

                _table   = _selectedEntity;
                _columns = BaseWizard <BaseWizardForm, WindowsFormsCodeGeneratorStrategy> .GetColumnsFromTable(_table, _connection);

                ItemTemplateUtilities.RetrieveAllFkInfo(_connection, _table, out ForeignKeys);
                _colValidations = ValidationsGrid.GetColumnValidationList(_table, _columns, ForeignKeys);
            }

            if ((_GuiType == Wizards.GuiType.MasterDetail) && ((_detailColumns == null) || (_detailColumns.Count == 0)))
            {
                GenerateDetailModelsForItemTemplates();
            }
        }