Update oracle demo

This commit is contained in:
sunkaixuan 2023-05-08 22:29:00 +08:00
parent d3e641a6ee
commit 764c1008ca

View File

@ -24,24 +24,25 @@ namespace OrmTest
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();
var list = db.Queryable<CodeFirstTable1>().ToList(); var list = db.Queryable<CodeFirstTable1>().ToList();
db.CodeFirst.InitTables<CodeFirstTable22>(); db.CodeFirst.InitTables<CodeFirstTable22x2>();
db.Updateable(new List<CodeFirstTable22>() { new CodeFirstTable22() { Name = "a" },new CodeFirstTable22() { Name = "a" } }) db.Updateable(new List<CodeFirstTable22x2>() { new CodeFirstTable22x2() { Name = "a" },new CodeFirstTable22x2() { Name = "a" } })
.ExecuteCommand(); .ExecuteCommand();
db.Updateable( new CodeFirstTable22() { Name = "a" } ) db.Updateable( new CodeFirstTable22x2() { Name = "a" } )
.ExecuteCommand(); .ExecuteCommand();
db.Insertable(new List<CodeFirstTable22>() { new CodeFirstTable22() { Name = "a" }, new CodeFirstTable22() { Name = "a" } }) db.Insertable(new List<CodeFirstTable22x2>() { new CodeFirstTable22x2() { Name = "a" }, new CodeFirstTable22x2() { Name = "a" } })
.ExecuteCommand(); .ExecuteCommand();
db.Insertable(new CodeFirstTable22() { Name = "a" }) db.Insertable(new CodeFirstTable22x2() { Name = "a" })
.ExecuteCommand(); .ExecuteCommand();
var list2=db.Queryable<CodeFirstTable22>().ToList(); var list2=db.Queryable<CodeFirstTable22x2>().ToList();
Console.WriteLine("#### CodeFirst end ####"); Console.WriteLine("#### CodeFirst end ####");
} }
} }
public class CodeFirstTable22 [SugarTable("CodeFirstTable22r2")]
public class CodeFirstTable22x2
{ {
[SugarColumn(OracleSequenceName = "SEQ_ID", IsPrimaryKey = true)] [SugarColumn(OracleSequenceName = "SEQ_ID", IsPrimaryKey = true)]
public int Id { get; set; } public int Id { get; set; }
[SugarColumn(ColumnDataType ="nvarchar2",Length =200, SqlParameterDbType =typeof(Nvarchar2PropertyConvert) )] [SugarColumn( SqlParameterDbType =typeof(Nvarchar2PropertyConvert) )]
public string Name { get; set; } public string Name { get; set; }
} }
public class CodeFirstTable1 public class CodeFirstTable1