mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 10:08:19 +08:00
32 lines
810 B
C#
32 lines
810 B
C#
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace OrmTest.Demo
|
|
{
|
|
public class CodeTable
|
|
{
|
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
|
public int Id { get; set; }
|
|
[SugarColumn(Length=40)]
|
|
public string Name { get; set; }
|
|
}
|
|
public class CodeFirst : DemoBase
|
|
{
|
|
public static void Init()
|
|
{
|
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
|
{
|
|
ConnectionString = Config.ConnectionString,
|
|
DbType = DbType.SqlServer,
|
|
IsAutoCloseConnection = true,
|
|
InitKeyType = InitKeyType.Attribute
|
|
});
|
|
|
|
db.CodeFirst.InitTables(typeof(CodeTable));
|
|
}
|
|
}
|
|
}
|