mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:22:57 +08:00
Add demo
This commit is contained in:
parent
25b88f4194
commit
9c715c8929
@ -35,8 +35,25 @@ namespace OrmTest
|
||||
db.CodeFirst.As<UnituLong>("UnituLong0011").InitTables<UnituLong>();
|
||||
Console.WriteLine("#### CodeFirst end ####");
|
||||
db.CodeFirst.InitTables<Unituadfasf1>();
|
||||
db.CodeFirst.InitTables<CodeFirstTable111>();
|
||||
db.Queryable<CodeFirstTable111>()
|
||||
.Select(it => new CodeFirstTable111()
|
||||
{
|
||||
Name = it.CreateTime.HasValue ? it.CreateTime.Value.ToString("yyyy-MM-dd") : string.Empty
|
||||
}).ToList();
|
||||
Console.WriteLine("#### CodeFirst end ####");
|
||||
}
|
||||
}
|
||||
public class CodeFirstTable111
|
||||
{
|
||||
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
[SugarColumn(ColumnDataType = "Nvarchar(255)")]//custom
|
||||
public string Text { get; set; }
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public DateTime? CreateTime { get; set; }
|
||||
}
|
||||
[SugarIndex("IndexUnituadfasf1_longx{include:name,id}", nameof(longx), OrderByType.Asc)]
|
||||
public class Unituadfasf1
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user