From fa22af532d339c02a0f03a79e1170744a8b1b827 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 8 Nov 2022 13:29:07 +0800 Subject: [PATCH] Add demo --- Src/Asp.Net/PgSqlTest/Demo/DemoE_CodeFirst.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Src/Asp.Net/PgSqlTest/Demo/DemoE_CodeFirst.cs b/Src/Asp.Net/PgSqlTest/Demo/DemoE_CodeFirst.cs index c474195d2..9ba1a11c5 100644 --- a/Src/Asp.Net/PgSqlTest/Demo/DemoE_CodeFirst.cs +++ b/Src/Asp.Net/PgSqlTest/Demo/DemoE_CodeFirst.cs @@ -23,10 +23,22 @@ namespace OrmTest db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1 db.Insertable(new CodeFirstTable1() { Name = "a", Text="a" }).ExecuteCommand(); var list = db.Queryable().ToList(); + db.CodeFirst.InitTables(); + db.Insertable(new CodeFirstArrary() + { + RoleIds=new long[] { 1,2} + }).ExecuteCommand(); + var list2=db.Queryable().Select(it => + it.RoleIds ).ToList(); + Console.WriteLine("#### CodeFirst end ####"); } } - + public class CodeFirstArrary + { + [SugarColumn(ColumnDescription = "绑定的角色ids", ColumnDataType = "int8[]", IsArray = true)] + public long[] RoleIds { get; set; } + } public class CodeFirstTable1 { [SugarColumn(IsIdentity = true, IsPrimaryKey = true)]