Test entities:
[Tableattribute ("test_student")] Public classStudent:mybaseclass {/// <summary> /// /// </summary>[Columnattribute ("GUID", dbtype.ansistring, ISPK =true)] Public stringGuid {Get;Set; } [Columnattribute ("Name", dbtype.ansistring)] Public stringName {Get;Set; } [Columnattribute (" Age", Dbtype.int32)] PublicInt32?Age {Get;Set; } [Columnattribute ("Height", Dbtype.decimal)] PublicDecimal?Height {Get;Set; } [Columnattribute ("Birthday", Dbtype.datetime)] PublicDatetime?Birthday {Get;Set; } }
Test code:
Private voidselecttest (Isqlhelper helper) {Mydbhelper FH=NewMydbhelper (helper); List<Student> LST =NULL; Student Stu=NewStudent (); Stu. Sethelper (helper); Stu. Name="Chyun"; LST= fh. Select<student>(Stu); LST= Stu. Select<student>(); Stu=NewStudent (); Stu. Sethelper (helper); Stu. Age= -; LST= fh. Select<student>(Stu); LST= Stu. Select<student>(); Stu=NewStudent (); Stu. Sethelper (helper); Stu. Age= -; Stu. Height=1.78M; LST= fh. Select<student>(Stu); LST= Stu. Select<student>(); Stu=NewStudent (); Stu. Sethelper (helper); Stu. Height=1.78M; LST= fh. Select<student>(Stu); LST= Stu. Select<student>(); } Private voidinserttest (Isqlhelper helper) {Student stu=NewStudent (); Stu. Sethelper (helper); Stu. Guid="e47f2c60ef00488b9f48747facc41ec5"; Stu. Name="Chyun"; Stu. Age= -; Stu. Height=1.78M; Stu. Birthday= DateTime.Parse ("1988-06-07 10:30:00"); Stu. Insert (); Stu=NewStudent (); Stu. Sethelper (helper); Stu. Guid=Guid.NewGuid (). ToString (); Stu. Name="Chyun"; //Stu. Age = +;Stu. Height =1.78M; Stu. Birthday= DateTime.Parse ("1988-06-07 10:31:00"); Stu. Insert (); Stu=NewStudent (); Stu. Sethelper (helper); Stu. Guid=Guid.NewGuid (). ToString (); Stu. Name="Chyun"; Stu. Age= -; Stu. Height=1.781M; Stu. Birthday= DateTime.Parse ("1988-06-07 10:32:00"); Stu. Insert (); } Private voidupdatetest (Isqlhelper helper) {Student stu=NewStudent (); Stu. Sethelper (helper); Stu. Guid="e47f2c60ef00488b9f48747facc41ec5"; Stu. Name="Chyun"; Stu. Age= -; Stu. Height=1.785M; Stu. Birthday= DateTime.Parse ("1988-06-07 10:30:30"); Stu. UPDATEBYPK (); } Private voiddeletetest (Isqlhelper helper) {Student stu=NewStudent (); Stu. Sethelper (helper); Stu. Guid="e47f2c60ef00488b9f48747facc41ec5"; Stu. Name="Chyun"; Stu. Age= -; Stu. Height=1.785M; Stu. Birthday= DateTime.Parse ("1988-06-07 10:30:30"); Stu. DELETEBYPK (); }
Please click to download the code
qq:519409748
C#_ Custom Simple ORM (ii) code download