Browse Source

Add unit test

pull/40/head
sunkaixuan 1 year ago
parent
commit
9d690557ad
  1. 14
      Src/Asp.Net/SqlServerTest/Demo/DemoE_CodeFirst.cs

14
Src/Asp.Net/SqlServerTest/Demo/DemoE_CodeFirst.cs

@ -70,9 +70,23 @@ namespace OrmTest
db.Insertable(new Unittest1011() { name = "a" }).ExecuteCommand(); db.Insertable(new Unittest1011() { name = "a" }).ExecuteCommand();
db.Insertable(new Unittest22221() { name = "a" }).ExecuteCommand(); db.Insertable(new Unittest22221() { name = "a" }).ExecuteCommand();
db.CodeFirst.InitTables<Unitrtqqqadfa>(); db.CodeFirst.InitTables<Unitrtqqqadfa>();
db.CodeFirst.InitTables<Unitrasdfafa>();
var id=db.Insertable(new Unitrasdfafa() { Name = "Unitrasdfafa" }).ExecuteReturnIdentity();
db.Updateable(new Unitrasdfafa() { Name = "Unitrasdfafa", id = id }).ExecuteCommand();
var xx=db.Queryable<Unitrasdfafa>().Select("*").ToDataTable();
Console.WriteLine("#### CodeFirst end ####"); Console.WriteLine("#### CodeFirst end ####");
} }
} }
[SugarTable("Unitrasdfafa",Discrimator ="Type:1,Type2:2")]
public class Unitrasdfafa
{
[SugarColumn(IsIdentity =true,IsPrimaryKey =true)]
public int id { get; set; }
public string Name { get; set; }
}
[SugarTable("dbo.Unitrtqqqadfa")] [SugarTable("dbo.Unitrtqqqadfa")]
public class Unitrtqqqadfa public class Unitrtqqqadfa
{ {

Loading…
Cancel
Save