【文件属性】:
文件名称:根据数据库表和字段生成对应的实体文件(.cs)包含注释
文件大小:18KB
文件格式:CS
更新时间:2023-01-23 04:18:23
生成实体类cs 动态生成CS文件 user_tab_comment
///
/// 生成实体类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);
}
}
}