This commit is contained in:
sunkaixuan 2022-11-11 12:46:37 +08:00
parent 25b88f4194
commit 9c715c8929

View File

@ -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
{