1. 首页
  2. 编程语言
  3. C#
  4. 根据数据库表和字段生成对应的实体文件(.cs)包含注释

根据数据库表和字段生成对应的实体文件(.cs)包含注释

上传者: 2021-05-05 23:14:26上传 CS文件 17.62KB 热度 10次
/// /// 生成实体类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); } } }
用户评论