mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Add demo
This commit is contained in:
parent
ee60691758
commit
7ebc12474a
@ -21,6 +21,9 @@ namespace OrmTest
|
|||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true
|
IsAutoCloseConnection = true
|
||||||
});
|
});
|
||||||
|
db.CodeFirst.InitTables<T_DICT>();
|
||||||
|
db.Updateable(new T_DICT() { LABEL = "a", TYPE = "a", TYPENAME = "a", VALUE = "a" })
|
||||||
|
.ExecuteCommand();
|
||||||
db.Aop.OnLogExecuting = (s, p) => Console.WriteLine(UtilMethods.GetNativeSql(s,p));
|
db.Aop.OnLogExecuting = (s, p) => Console.WriteLine(UtilMethods.GetNativeSql(s,p));
|
||||||
db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1
|
db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1
|
||||||
db.Insertable(new CodeFirstTable1() { Name = "a", Text="a" }).ExecuteCommand();
|
db.Insertable(new CodeFirstTable1() { Name = "a", Text="a" }).ExecuteCommand();
|
||||||
@ -40,6 +43,39 @@ namespace OrmTest
|
|||||||
Console.WriteLine("#### CodeFirst end ####");
|
Console.WriteLine("#### CodeFirst end ####");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 测试表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("T_DICT")]
|
||||||
|
public class T_DICT
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:字典类型
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true)]
|
||||||
|
public string TYPE { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:字典名称
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string? TYPENAME { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:字典键值
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true)]
|
||||||
|
public string VALUE { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:字典标签
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string? LABEL { get; set; }
|
||||||
|
}
|
||||||
public class CodeFirstUnitrew
|
public class CodeFirstUnitrew
|
||||||
{
|
{
|
||||||
public int Index { get; set; }
|
public int Index { get; set; }
|
||||||
|
Loading…
Reference in New Issue
Block a user