sunkaixuan
8 years ago
12 changed files with 155 additions and 31 deletions
@ -0,0 +1,31 @@ |
|||
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)); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue