public DBS_ColInfo(DataRow dr)
        {
            DBS_TypeMap TM = new DBS_TypeMap();

            #region 类型判断
            if (TM[dr["Xtype_Name"].ToString()].CodeType == "string")
            {
                IsString = true;
            }
            else if (TM[dr["Xtype_Name"].ToString()].CodeType == "decimal")
            {
                IsDecimal = true;
            }
            else if (TM[dr["Xtype_Name"].ToString()].CodeType == "double")
            {
                IsDouble = true;
            }
            else if (TM[dr["Xtype_Name"].ToString()].CodeType == "int" || TM[dr["Xtype_Name"].ToString()].CodeType == "Int32")
            {
                IsInt = true;
            }
            else if (TM[dr["Xtype_Name"].ToString()].CodeType == "Int64")
            {
                IsLong = true;
            }
            else if (TM[dr["Xtype_Name"].ToString()].CodeType == "DateTime")
            {
                IsDatetime = true;
            }
            #endregion

            if (!string.IsNullOrEmpty(dr["dval"].ToString()))
            {
                DefaultVal = dr["dval"].ToString();
            }
            CodeTypeStr = TM[dr["Xtype_Name"].ToString()].CodeType;
            ColName     = dr["name"].ToString();
            DBTypeStr   = TM[dr["Xtype_Name"].ToString()].DBType;
            if (dr["IsIdentity"].ToString() == "1")
            {
                IsAutoIncrement = true;
            }
            if (dr["PK"].ToString() == "1")
            {
                IsPrimaryKey = true;
            }
        }
        public string CreateFileContent()
        {
            StringBuilder txt = new StringBuilder();

            txt.AppendLine("using System;");
            txt.AppendLine("using XORM.NBase;");
            txt.AppendLine("using XORM.NBase.Attr;");
            txt.AppendLine("");
            txt.AppendLine("namespace " + this._namespaceHead.TrimEnd(new char[] { '.' }));
            txt.AppendLine("{");
            txt.AppendLine("\t/// <summary>");
            txt.AppendLine("\t/// 数据实体类:" + this._tableName);
            txt.AppendLine("\t/// </summary>");
            txt.AppendLine("\t[DbSource(\"" + _ConnectionMark + "\")]");
            txt.AppendLine("\tpublic class " + this._tableName + " : ModelBase<" + this._tableName + ">");
            txt.AppendLine("\t{");

            DBS_TypeMap TM = new DBS_TypeMap();

            txt.AppendLine("\t\t#region 字段、属性");
            foreach (DataRow dr in DT.Rows)
            {
                DBS_ColInfo info = new NTool.DBS_ColInfo(dr);
                if (info.DBTypeStr == "uniqueidentifier")
                {
                    continue;
                }
                if (info.DBTypeStr == "timestamp")
                {
                    continue;
                }
                txt.AppendLine("\t\t/// <summary>");
                txt.AppendLine("\t\t/// " + dr["Description"].ToString().Replace("\r", "").Replace("\n", ""));
                txt.AppendLine("\t\t/// </summary>");
                #region 列特性
                StringBuilder ColAttrBuilder = new StringBuilder();
                if (info.IsAutoIncrement)
                {
                    if (ColAttrBuilder.Length > 0)
                    {
                        ColAttrBuilder.Append(",");
                    }
                    ColAttrBuilder.Append("AutoInCrement");
                }
                if (info.IsPrimaryKey)
                {
                    if (ColAttrBuilder.Length > 0)
                    {
                        ColAttrBuilder.Append(",");
                    }
                    ColAttrBuilder.Append("PrimaryKey");
                }
                if (ColAttrBuilder.Length > 0)
                {
                    ColAttrBuilder.Append(",");
                }
                ColAttrBuilder.Append("DBCol");
                ColAttrBuilder.Append("]");
                ColAttrBuilder.Insert(0, "\t\t[");
                txt.AppendLine(ColAttrBuilder.ToString());
                #endregion
                if (TM.IsKeyWord(info.ColName))
                {
                    txt.AppendLine("\t\tpublic @" + info.CodeTypeStr + " " + info.ColName);
                }
                else
                {
                    txt.AppendLine("\t\tpublic " + info.CodeTypeStr + " " + info.ColName);
                }
                txt.AppendLine("\t\t{");
                txt.AppendLine("\t\t\tget{ return this._" + info.ColName + ";}");
                txt.AppendLine("\t\t\tset{ this._" + info.ColName + " = value; ModifiedColumns.Add(\"[" + info.ColName.ToUpper() + "]\"); }");
                txt.AppendLine("\t\t}");

                if (info.IsString)
                {
                    if (string.IsNullOrEmpty(info.DefaultVal))
                    {
                        txt.AppendLine("\t\tprivate " + info.CodeTypeStr + " _" + info.ColName + " = \"\";");
                    }
                    else
                    {
                        txt.AppendLine("\t\tprivate " + info.CodeTypeStr + " _" + info.ColName + " = \"" + info.DefaultVal.Replace("(", "").Replace(")", "").Replace("'", "") + "\";");
                    }
                }
                else if (info.IsDecimal)
                {
                    if (string.IsNullOrEmpty(info.DefaultVal))
                    {
                        txt.AppendLine("\t\tprivate " + info.CodeTypeStr + " _" + info.ColName + " = 0M;");
                    }
                    else
                    {
                        txt.AppendLine("\t\tprivate " + info.CodeTypeStr + " _" + info.ColName + " = " + info.DefaultVal.Replace("(", "").Replace(")", "").Replace("'", "") + "M;");
                    }
                }
                else if (info.IsDouble)
                {
                    if (string.IsNullOrEmpty(info.DefaultVal))
                    {
                        txt.AppendLine("\t\tprivate " + info.CodeTypeStr + " _" + info.ColName + " = 0;");
                    }
                    else
                    {
                        txt.AppendLine("\t\tprivate " + info.CodeTypeStr + " _" + info.ColName + " = " + info.DefaultVal.Replace("(", "").Replace(")", "").Replace("'", "") + ";");
                    }
                }
                else if (info.IsInt)
                {
                    if (string.IsNullOrEmpty(info.DefaultVal))
                    {
                        txt.AppendLine("\t\tprivate " + info.CodeTypeStr + " _" + info.ColName + " = 0;");
                    }
                    else
                    {
                        txt.AppendLine("\t\tprivate " + info.CodeTypeStr + " _" + info.ColName + " = " + info.DefaultVal.Replace("(", "").Replace(")", "").Replace("'", "") + ";");
                    }
                }
                else if (info.IsLong)
                {
                    if (string.IsNullOrEmpty(info.DefaultVal))
                    {
                        txt.AppendLine("\t\tprivate " + info.CodeTypeStr + " _" + info.ColName + " = 0L;");
                    }
                    else
                    {
                        txt.AppendLine("\t\tprivate " + info.CodeTypeStr + " _" + info.ColName + " = " + info.DefaultVal.Replace("(", "").Replace(")", "").Replace("'", "") + "L;");
                    }
                }
                else if (info.IsDatetime)
                {
                    if (string.IsNullOrEmpty(info.DefaultVal))
                    {
                        txt.AppendLine("\t\tprivate " + info.CodeTypeStr + " _" + info.ColName + " = DateTime.Now;");
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(info.DefaultVal))
                        {
                            txt.AppendLine("\t\tprivate " + info.CodeTypeStr + " _" + info.ColName + " = DateTime.Now;");
                        }
                        else
                        {
                            if (info.DefaultVal.ToUpper().Contains("GETDATE") || info.DefaultVal.ToUpper().Contains("CURRENT_TIMESTAMP") || info.DefaultVal.ToUpper().Contains("NOW"))
                            {
                                txt.AppendLine("\t\tprivate " + info.CodeTypeStr + " _" + info.ColName + " = DateTime.Now;");
                            }
                            else
                            {
                                txt.AppendLine("\t\tprivate " + info.CodeTypeStr + " _" + info.ColName + " = DateTime.Parse(\"" + info.DefaultVal.Replace("(", "").Replace(")", "").Replace("'", "") + "\");");
                            }
                        }
                    }
                }
                else
                {
                    txt.AppendLine("\t\tprivate " + info.CodeTypeStr + " _" + info.ColName + ";");
                }
            }
            txt.AppendLine("\t\t#endregion");
            txt.AppendLine("\t}");
            txt.Append("}");

            return(txt.ToString());
        }