///// <summary>
        ///// Applies project settings to .NET data type
        ///// </summary>
        //private string NaturalizeNames_DotNetType(string dotNetTypeName)
        //{
        //    return dotNetTypeName.Replace(DbColumn.DotNetArrayIdenticator, _patternProject.LanguageSettings.ArrayIdenticator);
        //}
        /// <summary>
        /// Applies project settings to fields name
        /// </summary>
        /// <param name="table"></param>
        /// <param name="fieldName"></param>
        /// <param name="isAlreadyMember">is the field aready member of the table, or it is an external</param>
        /// <returns></returns>
        private string NaturalizeNames_FieldName(DbTable table, DbColumn column, string fieldName, bool isAlreadyMember)
        {
            if (string.IsNullOrEmpty(fieldName))
                return fieldName;
            var newName = fieldName;

            var stringCompare = StringComparison.InvariantCulture;
            if (_patternProject.LanguageSettings.KeywordsCaseSensitive == false)
                stringCompare = StringComparison.InvariantCultureIgnoreCase;

            // suppress pattern
            string replacement = _patternProject.LanguageSettings.LanguageKeywordsSuppress;

            // renaming options
            newName = NaturalizeNames_RenamingOptions(newName, _projectDef.RenamingOptions, false, true);

            // remove names
            newName = NaturalizeNames_Name_RemoveInvalidChars(newName);

            int initReplacePartCount = 0;
            string initReplacePartStr = "";

            // column name should not be same
            if (newName.Equals(table.TableNameSchema, stringCompare) ||
                newName.Equals(table.TableNameSchemaCS, stringCompare))
            {
                var renamedName = string.Format(replacement, newName, initReplacePartStr);
                initReplacePartCount++;
                initReplacePartStr = initReplacePartCount.ToString();

                // no duplicate
                while (table.FindColumnSchema(renamedName) != null)
                {
                    renamedName = string.Format(replacement, newName, initReplacePartStr);
                    initReplacePartCount++;
                    initReplacePartStr = initReplacePartCount.ToString();
                }

                newName = renamedName;
            }

            // field name is not changed and is a member
            if (newName.Equals(fieldName, stringCompare) && isAlreadyMember)
            {
                var sameNameColumns =
                    table.SchemaColumns.Where(x => x.FieldNameSchema.Equals(newName, stringCompare)).ToList();

                // no more than one accurance, including itself
                if (sameNameColumns.Count > 1 &&
                    sameNameColumns.IndexOf(column) > 0)
                {
                    var renamedName = string.Format(replacement, newName, initReplacePartStr);
                    initReplacePartCount++;
                    initReplacePartStr = initReplacePartCount.ToString();

                    // no duplicate
                    while (table.FindColumnSchema(renamedName) != null)
                    {
                        renamedName = string.Format(replacement, newName, initReplacePartStr);
                        initReplacePartCount++;
                        initReplacePartStr = initReplacePartCount.ToString();
                    }
                    newName = renamedName;
                }
            }
            else
            {
                if (table.FindColumnSchema(newName) != null)
                {
                    var renamedName = string.Format(replacement, newName, initReplacePartStr);
                    initReplacePartCount++;
                    initReplacePartStr = initReplacePartCount.ToString();

                    // no duplicate
                    while (table.FindColumnSchema(renamedName) != null)
                    {
                        renamedName = string.Format(replacement, newName, initReplacePartStr);
                        initReplacePartCount++;
                        initReplacePartStr = initReplacePartCount.ToString();
                    }
                    newName = renamedName;
                }
            }

            // checking keyword match if only not changed field name
            if (newName.Equals(fieldName, stringCompare))
            {
                // ignoring keywords
                foreach (var keyword in _patternProject.LanguageSettings.LanguageKeywords)
                {
                    // keyword match
                    if (newName.Equals(keyword, stringCompare))
                    {
                        var renamedName = string.Format(replacement, newName, initReplacePartStr);
                        initReplacePartCount++;
                        initReplacePartStr = initReplacePartCount.ToString();

                        // no duplicate
                        while (table.FindColumnSchema(renamedName) != null)
                        {
                            renamedName = string.Format(replacement, newName, initReplacePartStr);
                            initReplacePartCount++;
                            initReplacePartStr = initReplacePartCount.ToString();
                        }

                        newName = renamedName;
                        // name is chaned and check is no longer required
                        break;
                    }
                }
            }

            // field name is ok to be used
            return newName;
        }
        /// <summary>
        /// Column data type is nullabe
        /// </summary>
        private bool Determine_DataTypeNullable(DbColumn dbColumn)
        {
            if (dbColumn.IsArray(_patternProject.LanguageSettings.ArrayIdenticator))
                return true;
            var stringCompare = StringComparison.CurrentCulture;
            if (!_patternProject.LanguageSettings.KeywordsCaseSensitive)
                stringCompare = StringComparison.InvariantCultureIgnoreCase;

            foreach (var dataType in _patternProject.LanguageSettings.NullableDataTypes)
            {
                var type = "." + dataType;
                if (dbColumn.DataTypeDotNet.EndsWith(type, stringCompare))
                {
                    return true;
                }
                if (dataType.Equals(dbColumn.DataTypeDotNet, stringCompare))
                {
                    return true;
                }
            }
            return false;
        }
        private bool Determine_ExplicitCastDataType(DbColumn dbColumn)
        {
            if (dbColumn.IsArray(_patternProject.LanguageSettings.ArrayIdenticator))
                return true;
            var stringCompare = StringComparison.CurrentCulture;
            if (!_patternProject.LanguageSettings.KeywordsCaseSensitive)
                stringCompare = StringComparison.InvariantCultureIgnoreCase;

            // any type that has any dot (.) in it!
            if (dbColumn.DataTypeDotNet.IndexOf('.') != -1)
                return true;

            foreach (var dataType in _patternProject.LanguageSettings.ExplicitCastDataTypes)
            {
                if (dataType.Equals(dbColumn.DataTypeDotNet, stringCompare))
                {
                    return true;
                }
            }
            return false;
        }
        /// <summary>
        /// One table, one column or one foreignKey in table!
        /// </summary>
        string PatternContentAppliesTo_OneTable(string baseContent,
			List<PatternContent> patternContent,
			DbTable table,
			DbColumn column,
			DbForeignKey foreignKey)
        {
            string appliedContent = "";

            // ---------------------------------
            // Only one table is applying here!

            // table can not be null here
            if (table == null)
            {
                return baseContent;
            }

            foreach (var pattern in patternContent)
            {
                string replacementName = string.Format(ReplaceConsts.PatternContentReplacer, pattern.Name);

                // is there a pattern for that
                if (baseContent.IndexOf(replacementName) == -1)
                    continue;

                switch (pattern.ConditionKeyMode)
                {
                    case PatternConditionKeyMode.General:
                        // nothing!
                        break;

                    case PatternConditionKeyMode.TablesAll:
                    case PatternConditionKeyMode.ViewsAll:
                    case PatternConditionKeyMode.TablesAndViewsAll:
                        // for one table? Meh, we do nothing!
                        break;

                    case PatternConditionKeyMode.TableAutoIncrement:
                    case PatternConditionKeyMode.TableIndexConstraint:
                    case PatternConditionKeyMode.TablePrimaryKey:
                    case PatternConditionKeyMode.TableUniqueConstraint:
                        appliedContent = ConditionItem_AppliesToTable(pattern, table);

                        // base content
                        if (!string.IsNullOrEmpty(pattern.BaseContent))
                        {
                            appliedContent = pattern.BaseContent.Replace(ReplaceConsts.PatternContentInnerContents, appliedContent);
                        }

                        // internal pattern contents
                        if (pattern.ConditionContents.Count > 0)
                        {
                            // nested call
                            appliedContent = PatternContentAppliesTo_OneTable(appliedContent, pattern.ConditionContents, table, null, null);
                        }

                        // replace the content
                        baseContent = baseContent.Replace(replacementName, appliedContent);
                        break;

                    case PatternConditionKeyMode.Field:
                    case PatternConditionKeyMode.FieldCondensedType:
                    case PatternConditionKeyMode.FieldKeyReadType:
                    case PatternConditionKeyMode.FieldKeyType:
                    case PatternConditionKeyMode.FieldPrimaryKey:
                    case PatternConditionKeyMode.FieldReferencedKeyType:
                        appliedContent = "";

                        // no special column is specified
                        if (column == null)
                        {
                            // replace in the main content
                            baseContent = Common.ReplaceEx(baseContent, replacementName, appliedContent, StringComparison.CurrentCulture);
                        }
                        else
                        {
                            // Apply the replacement to the pattern content
                            string columnReplace = ConditionItem_AppliesToColumn(pattern, table, column);

                            // The seperator
                            if (!string.IsNullOrEmpty(columnReplace))
                            {
                                // internal pattern contents
                                // FOR EACH column
                                if (pattern.ConditionContents.Count > 0)
                                {
                                    // nested call
                                    columnReplace = PatternContentAppliesTo_OneTable(
                                        columnReplace,
                                        pattern.ConditionContents,
                                        table,
                                        column,
                                        null);
                                }
                                appliedContent += columnReplace + pattern.ItemsSeperator;
                            }
                        }

                        // Remove additional ItemsSeperator
                        if (!string.IsNullOrEmpty(pattern.ItemsSeperator)
                            && appliedContent.EndsWith(pattern.ItemsSeperator))
                            appliedContent = appliedContent.Remove(appliedContent.Length - pattern.ItemsSeperator.Length, pattern.ItemsSeperator.Length);

                        // internal pattern contents
                        // FOR EACH column
                        if (pattern.ConditionContents.Count > 0)
                        {
                            // nested call
                            appliedContent = PatternContentAppliesTo_OneTable(appliedContent, pattern.ConditionContents, table, null, null);
                        }

                        // replace in the main content
                        baseContent = Common.ReplaceEx(baseContent, replacementName, appliedContent, StringComparison.CurrentCulture);
                        break;

                    case PatternConditionKeyMode.FieldsAll:
                    case PatternConditionKeyMode.FieldsCondensedTypeAll:
                    case PatternConditionKeyMode.FieldsKeyReadTypeAll:
                    case PatternConditionKeyMode.FieldsKeyTypeAll:
                    case PatternConditionKeyMode.FieldsPrimaryKeyAll:
                    case PatternConditionKeyMode.FieldsReferencedKeyTypeAll:
                        appliedContent = "";

                        // fetch the columns and apply the replacement operation
                        foreach (var tableColumn in table.SchemaColumns)
                        {
                            // Apply the replacement to the pattern content
                            string columnReplace = ConditionItem_AppliesToColumn(pattern, table, tableColumn);

                            // The seperator
                            if (!string.IsNullOrEmpty(columnReplace))
                            {
                                // internal pattern contents
                                // FOR EACH column
                                if (pattern.ConditionContents.Count > 0)
                                {
                                    // nested call
                                    columnReplace = PatternContentAppliesTo_OneTable(
                                        columnReplace,
                                        pattern.ConditionContents,
                                        table,
                                        tableColumn, null);
                                }
                                appliedContent += columnReplace + pattern.ItemsSeperator;
                            }
                        }

                        // Remove additional ItemsSeperator
                        if (!string.IsNullOrEmpty(pattern.ItemsSeperator)
                            && appliedContent.EndsWith(pattern.ItemsSeperator))
                            appliedContent = appliedContent.Remove(appliedContent.Length - pattern.ItemsSeperator.Length, pattern.ItemsSeperator.Length);

                        // internal pattern contents
                        // FOR EACH column
                        if (pattern.ConditionContents.Count > 0)
                        {
                            // nested call
                            appliedContent = PatternContentAppliesTo_OneTable(appliedContent, pattern.ConditionContents, table, null, null);
                        }

                        // replace in the main content
                        baseContent = Common.ReplaceEx(baseContent, replacementName, appliedContent, StringComparison.CurrentCulture);
                        break;

                    case PatternConditionKeyMode.ForeignKeyDeleteAction:
                    case PatternConditionKeyMode.ForeignKeyUpdateAction:
                    case PatternConditionKeyMode.FieldForeignKey:
                        appliedContent = "";

                        if (foreignKey == null)
                        {
                            // replace in the main content
                            baseContent = Common.ReplaceEx(baseContent, replacementName, appliedContent, StringComparison.CurrentCulture);
                        }
                        else
                        {
                            // Apply the replacement to the pattern content
                            string columnReplace = ConditionItem_AppliesToForeignKeyColumns(pattern, table, foreignKey);

                            // The seperator
                            if (!string.IsNullOrEmpty(columnReplace))
                            {
                                // internal pattern contents
                                if (pattern.ConditionContents.Count > 0)
                                {
                                    // nested call
                                    columnReplace = PatternContentAppliesTo_OneTable(
                                        columnReplace,
                                        pattern.ConditionContents,
                                        table,
                                        null,
                                        foreignKey);
                                }

                                appliedContent += columnReplace + pattern.ItemsSeperator;
                            }
                        }

                        // Remove additional ItemsSeperator
                        if (!string.IsNullOrEmpty(pattern.ItemsSeperator)
                            && appliedContent.EndsWith(pattern.ItemsSeperator))
                            appliedContent = appliedContent.Remove(appliedContent.Length - pattern.ItemsSeperator.Length, pattern.ItemsSeperator.Length);

                        // internal pattern contents
                        if (pattern.ConditionContents.Count > 0)
                        {
                            // nested call
                            appliedContent = PatternContentAppliesTo_OneTable(appliedContent, pattern.ConditionContents, table, null, null);
                        }

                        // replace in the main content
                        baseContent = Common.ReplaceEx(baseContent, replacementName, appliedContent, StringComparison.CurrentCulture);
                        break;

                    case PatternConditionKeyMode.FieldsForeignKeyAll:
                    case PatternConditionKeyMode.TableForeignKey:
                        appliedContent = "";

                        // fetch the columns and apply the replacement operation
                        foreach (var dbForeignKey in table.ForeignKeys)
                        {
                            // Apply the replacement to the pattern content
                            string columnReplace = ConditionItem_AppliesToForeignKeyColumns(pattern, table, dbForeignKey);

                            // The seperator
                            if (!string.IsNullOrEmpty(columnReplace))
                            {
                                // internal pattern contents
                                if (pattern.ConditionContents.Count > 0)
                                {
                                    // nested call
                                    columnReplace = PatternContentAppliesTo_OneTable(
                                        columnReplace,
                                        pattern.ConditionContents,
                                        table,
                                        null,
                                        dbForeignKey);
                                }

                                appliedContent += columnReplace + pattern.ItemsSeperator;
                            }
                        }

                        // Remove additional ItemsSeperator
                        if (!string.IsNullOrEmpty(pattern.ItemsSeperator)
                            && appliedContent.EndsWith(pattern.ItemsSeperator))
                            appliedContent = appliedContent.Remove(appliedContent.Length - pattern.ItemsSeperator.Length, pattern.ItemsSeperator.Length);

                        // internal pattern contents
                        if (pattern.ConditionContents.Count > 0)
                        {
                            // nested call
                            appliedContent = PatternContentAppliesTo_OneTable(appliedContent, pattern.ConditionContents, table, null, null);
                        }

                        // replace in the main content
                        baseContent = Common.ReplaceEx(baseContent, replacementName, appliedContent, StringComparison.CurrentCulture);
                        break;

                    default:
                        break;
                }
            }

            return baseContent;
        }
        /// <summary>
        /// Get field type database full name
        /// </summary>
        private string FieldType_ColumnDataTypeSize(DbColumn column)
        {
            string cleanType = (column.DataTypeDotNet);

            if (cleanType == "String" &&
                column.DataTypeDb.ToLower().IndexOf(_patternProject.LanguageSettings.TextFieldIdenticator) == -1)
                return column.DataTypeDb + "(" + column.Length + ")";

            if (column.DataTypeDb.ToLower() == _patternProject.LanguageSettings.DbDecimalName.ToLower())
            {
                return _patternProject.LanguageSettings.DbDecimalType
                    .Replace(ReplaceConsts.Pattern_LanguageSettings_Precision, column.NumericPrecision.ToString())
                    .Replace(ReplaceConsts.Pattern_LanguageSettings_Scale, column.NumericScale.ToString());
            }
            else if (column.DataTypeDb.ToLower() == _patternProject.LanguageSettings.DbNumericName.ToLower())
            {
                return _patternProject.LanguageSettings.DbNumericType
                    .Replace(ReplaceConsts.Pattern_LanguageSettings_Precision, column.NumericPrecision.ToString())
                    .Replace(ReplaceConsts.Pattern_LanguageSettings_Scale, column.NumericScale.ToString());
            }
            return column.DataTypeDb;
        }
 /// <summary>
 /// Get field size
 /// </summary>
 private string FieldType_ColumnDataSize(DbColumn column)
 {
     if (column.Length > 0)
         return column.Length.ToString();
     if (column.DataTypeMaxLength > 0)
         return column.DataTypeMaxLength.ToString();
     return "0";
 }
        /// <summary>
        /// Partial content replacer.
        /// </summary>
        string ConditionItem_AppliesToColumn(PatternContent partialContent, DbTable table, DbColumn column)
        {
            switch (partialContent.ConditionKeyMode)
            {
                //case PatternConditionKeyMode.DatabaseProvider:
                //    ConditionItem dbReplacer = null;

                //    switch (this._database.Provider)
                //    {
                //        case DatabaseProvider.Oracle:
                //            dbReplacer = partialContent.GetReplacement(ConditionKeyModeConsts.DatabaseProvider._Oracle);
                //            break;

                //        case DatabaseProvider.SQLServer:
                //            dbReplacer = partialContent.GetReplacement(ConditionKeyModeConsts.DatabaseProvider.SQLServer);
                //            break;

                //        case DatabaseProvider.SQLite:
                //            dbReplacer = partialContent.GetReplacement(ConditionKeyModeConsts.DatabaseProvider.SQLite);
                //            break;

                //        case DatabaseProvider.SqlCe4:
                //            dbReplacer = partialContent.GetReplacement(ConditionKeyModeConsts.DatabaseProvider.SqlCe4);
                //            break;
                //    }

                //    if (dbReplacer == null)
                //        return "";

                //    // Replace the contents
                //    return Replacer_ConditionItem_AppliesToColumn(dbReplacer.Content, table, column);

                case PatternConditionKeyMode.FieldsAll:
                case PatternConditionKeyMode.Field:
                    var replacer = partialContent.GetFirst();

                    // Replace the contents
                    return Replacer_ConditionItem_AppliesToColumn(replacer.ContentText, table, column);

                case PatternConditionKeyMode.FieldsCondensedTypeAll:
                case PatternConditionKeyMode.FieldCondensedType:
                    ConditionItem replacerCondensedType = null;

                    switch (column.DataCondensedType)
                    {
                        case DbColumn.ColumnCondensedType.None:
                            replacerCondensedType = partialContent.GetReplacement(ConditionKeyModeConsts.FieldCondensedType.None);
                            break;

                        case DbColumn.ColumnCondensedType.String:
                            replacerCondensedType = partialContent.GetReplacement(ConditionKeyModeConsts.FieldCondensedType.String);
                            break;

                        case DbColumn.ColumnCondensedType.Decimal:
                            replacerCondensedType = partialContent.GetReplacement(ConditionKeyModeConsts.FieldCondensedType.Decimal);
                            break;

                        case DbColumn.ColumnCondensedType.Integer:
                            replacerCondensedType = partialContent.GetReplacement(ConditionKeyModeConsts.FieldCondensedType.Integer);
                            break;
                    }

                    // Replace the contents
                    if (replacerCondensedType != null)
                        return Replacer_ConditionItem_AppliesToColumn(replacerCondensedType.ContentText, table, column);
                    return string.Empty;

                case PatternConditionKeyMode.FieldsPrimaryKeyAll:
                case PatternConditionKeyMode.FieldPrimaryKey:
                    ConditionItem primaryReplacer;

                    if (column.PrimaryKey)
                        primaryReplacer = partialContent.GetReplacement(ConditionKeyModeConsts.FieldPrimaryKey.PrimaryKey);
                    else
                        primaryReplacer = partialContent.GetReplacement(ConditionKeyModeConsts.FieldPrimaryKey.NormalField);

                    // Replace the contents
                    return Replacer_ConditionItem_AppliesToColumn(primaryReplacer.ContentText, table, column);

                case PatternConditionKeyMode.FieldReferencedKeyType:
                case PatternConditionKeyMode.FieldKeyType:
                case PatternConditionKeyMode.FieldsReferencedKeyTypeAll:
                case PatternConditionKeyMode.FieldsKeyTypeAll:
                    ConditionItem keyTypeReplacer;

                    // this key is not reference type
                    if (_patternProject.SeperateReferenceColumns)
                    {
                        if (column.IsReferenceKey && partialContent.ConditionKeyMode == PatternConditionKeyMode.FieldsKeyTypeAll)
                            return "";
                        if (!column.IsReferenceKey && partialContent.ConditionKeyMode == PatternConditionKeyMode.FieldsReferencedKeyTypeAll)
                            return "";
                    }

                    // Key type
                    bool dataTypeNotNullable = !column.DataTypeNullable;

                    if (column.AutoIncrement && column.PrimaryKey)
                    {
                        keyTypeReplacer = partialContent.GetReplacement(ConditionKeyModeConsts.FieldKeyType.AutoInrcementPrimaryKey);
                    }
                    else if (column.AutoIncrement && column.AllowNull && !dataTypeNotNullable)
                    {
                        // AutoIncrement
                        // Nullable column
                        // Nullable object
                        keyTypeReplacer = partialContent.GetReplacement(ConditionKeyModeConsts.FieldKeyType.AutoIncNativeNullable);
                    }
                    else if (column.AutoIncrement && column.AllowNull && dataTypeNotNullable)
                    {
                        keyTypeReplacer = partialContent.GetReplacement(ConditionKeyModeConsts.FieldKeyType.AutoIncNullableType);
                    }
                    else if (column.AutoIncrement)
                    {
                        keyTypeReplacer = partialContent.GetReplacement(ConditionKeyModeConsts.FieldKeyType.AutoInrcement);
                    }
                    else if (column.PrimaryKey)
                    {
                        keyTypeReplacer = partialContent.GetReplacement(ConditionKeyModeConsts.FieldKeyType.PrimaryKey);
                    }
                    else if (column.AllowNull && !dataTypeNotNullable)
                    {
                        keyTypeReplacer = partialContent.GetReplacement(ConditionKeyModeConsts.FieldKeyType.NativeNullable);
                    }
                    else if (column.AllowNull && dataTypeNotNullable)
                    {
                        keyTypeReplacer = partialContent.GetReplacement(ConditionKeyModeConsts.FieldKeyType.NullableType);
                    }
                    else
                    {
                        keyTypeReplacer = partialContent.GetReplacement(ConditionKeyModeConsts.FieldKeyType.NormalField);
                    }

                    // Replace the contents
                    return Replacer_ConditionItem_AppliesToColumn(keyTypeReplacer.ContentText, table, column);

                case PatternConditionKeyMode.FieldsKeyReadTypeAll:
                case PatternConditionKeyMode.FieldKeyReadType:
                    ConditionItem keyRead;

                    bool canConvert = !column.ExplicitCastDataType; // TODO

                    // how to read key type

                    if (!column.AllowNull && canConvert)
                    {
                        keyRead = partialContent.GetReplacement(ConditionKeyModeConsts.FieldKeyReadType.NormalField_Convert);
                    }
                    else if (!column.AllowNull && !canConvert)
                    {
                        keyRead = partialContent.GetReplacement(ConditionKeyModeConsts.FieldKeyReadType.NormalField_Cast);
                    }
                    else if (column.AllowNull && canConvert)
                    {
                        keyRead = partialContent.GetReplacement(ConditionKeyModeConsts.FieldKeyReadType.Nullable_Convert);
                    }
                    else
                    {
                        keyRead = partialContent.GetReplacement(ConditionKeyModeConsts.FieldKeyReadType.Nullable_Cast);
                    }
                    // Replace the contents
                    return Replacer_ConditionItem_AppliesToColumn(keyRead.ContentText, table, column);

                default:
                    // Ignored
                    return "";
            }
        }
        /// <summary>
        /// Applies column data to pattern content replacement
        /// </summary>
        string Replacer_ConditionItem_AppliesToColumn(string content, DbTable table, DbColumn column)
        {
            // table of the column
            content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.TableName, table.TableNameSchema);
            content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.TableNameDb, table.TableName);
            content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.TableOwnerName, table.OwnerName);

            // general
            content = Replacer_GeneratorGeneral(content);

            // database provider class
            content = Replacer_DatabaseProvider(content);

            // referenced table of the column
            if (column.IsReferenceKey && column.IsReferenceKeyTable != null)
            {
                var refTable = column.IsReferenceKeyTable;

                content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.TableNameRefField, refTable.TableNameSchema);
                content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.TableNameDbRefField, refTable.TableName);
            }

            // column information
            content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.FieldDataType, column.DataTypeDotNet);
            content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.FieldName, column.FieldNameSchema);
            content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.FieldNameDb, column.FieldNameDb);

            content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.FieldOrdinalValue, column.ColumnOrdinal.ToString());
            content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.FieldIsPrimaryKey, column.PrimaryKey.ToString().ToLower());
            content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.FieldCanBeNull, column.AllowNull.ToString().ToLower());

            // column description
            content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.FieldDescription, column.UserDescription);

            // Database field type
            content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.FieldDbType, column.DataTypeDb);
            content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.FieldDbTypeSize, FieldType_ColumnDataTypeSize(column));
            content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.FieldDbSize, FieldType_ColumnDataSize(column));

            if (column.AutoIncrement)
                content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.AutoIncrementDataType, column.DataTypeDotNet);
            else
                content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.AutoIncrementDataType, _patternProject.LanguageSettings.VoidDataType);

            if (column.PrimaryKey)
            {
                content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.PrimaryKeyDbType, column.DataTypeDb);
                content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.PrimaryKeyDbTypeSize, FieldType_ColumnDataTypeSize(column));
                content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.PrimaryKeyDataType, column.DataTypeDotNet);
                content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.PrimaryKeyName, column.FieldNameSchema);
                content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.PrimaryKeyNameDb, column.FieldNameDb);
            }
            else
            {
                content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.PrimaryKeyDbType, "");
                content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.PrimaryKeyDbTypeSize, "");
                content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.PrimaryKeyDataType, _patternProject.LanguageSettings.VoidDataType);
                content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.PrimaryKeyName, "");
                content = Common.ReplaceExIgnoreCase(content, ReplaceConsts.PrimaryKeyNameDb, "");
            }

            return content;
        }