SqlSugar
//实体
//IsIdentity = true自增 IsPrimaryKey = true 主键
//
[SugarColumn(IsNullable = false, IsPrimaryKey = true, IsIdentity = true )]
public string user{get;set;}
实体生成
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;
namespace SqlSugarDB
{
/// <summary>
/// 生成实体
/// </summary>
public class GenerateEntity
{
public static void Entity() {
SqlSugarClient db = DBSqlServer.DB;
try
{
db.DbFirst.IsCreateDefaultValue().CreateClassFile("C:\\Users\\Administrator\\Desktop\\sqlsugar");
// LogHelp.info("实体生成完成");
}
catch (Exception ex)
{
//LogHelp.error("实体生成:"+ ex.Message);
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
}
}
<