根据数据库表和字段生成对应的实体文件(.cs)包含注释
/// /// 生成实体类cs文件 /// public static void CreateEntityCode() { using (SqlSugarClient db = CreateDBContext()) { string p = "XT_"; string TABLE_NAME = ""; string COMMENTS = ""; string sql = "select TABLE_NAME,COMMENTS from user_tab_comments "; DataTable dt1 = db.Ado.GetDataTable(sql); for (int i = 0; i < dt1.Rows.Count; i++) { TABLE_NAME = dt1.Rows[i]["TABLE_NAME"].ToString(); //表名 COMMENTS = dt1.Rows[i]["COMMENTS"].ToString(); //描述 p = TABLE_NAME.Substring(0, TABLE_NAME.IndexOf("_")); CreateEntityCode(TABLE_NAME, COMMENTS, p); } } }
用户评论