Browse Source

Update demo

pull/12/MERGE
sunkaixuan 6 years ago
parent
commit
b1fdba86e8
  1. 2
      Src/Asp.Net/SqliteTest/UnitTest/UCodeFirst.cs
  2. 2
      Src/Asp.Net/SqliteTest/UnitTest/UJson.cs
  3. 12
      Src/Asp.Net/SqliteTest/UnitTest/UQueryable.cs
  4. 8
      Src/Asp.Net/SqliteTest/UnitTest/Updateable.cs

2
Src/Asp.Net/SqliteTest/UnitTest/UCodeFirst.cs

@ -16,9 +16,7 @@ namespace OrmTest
} }
public class UnitCodeTest1 public class UnitCodeTest1
{ {
[SqlSugar.SugarColumn(IndexGroupNameList = new string[] { "group1" })]
public int Id { get; set; } public int Id { get; set; }
[SqlSugar.SugarColumn(DefaultValue="getdate()", IndexGroupNameList =new string[] {"group1" } )]
public DateTime? CreateDate { get; set; } public DateTime? CreateDate { get; set; }
} }
} }

2
Src/Asp.Net/SqliteTest/UnitTest/UJson.cs

@ -28,7 +28,7 @@ namespace OrmTest
{ {
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)] [SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; } public int Id { get; set; }
[SqlSugar.SugarColumn(ColumnDataType = "varchar(max)", IsJson = true)] [SqlSugar.SugarColumn(ColumnDataType = "varchar(4000)", IsJson = true)]
public Order Order { get; set; } public Order Order { get; set; }
} }
} }

12
Src/Asp.Net/SqliteTest/UnitTest/UQueryable.cs

@ -39,18 +39,18 @@ namespace OrmTest
DcNull = it.Dc, DcNull = it.Dc,
Dc = it.Int Dc = it.Int
}).ToSql().Key; }).ToSql().Key;
UValidate.Check(sql, "SELECT [Dc] AS [DcNull] , [Int] AS [Dc] FROM [UnitSelectTest]", "Queryable"); UValidate.Check(sql, "SELECT `Dc` AS `DcNull` , `Int` AS `Dc` FROM `UnitSelectTest`", "Queryable");
sql = Db.Updateable<UnitSelectTest2>(new UnitSelectTest2()).ToSql().Key; sql = Db.Updateable<UnitSelectTest2>(new UnitSelectTest2()).ToSql().Key;
UValidate.Check(sql, @"UPDATE [UnitSelectTest2] SET UValidate.Check(sql, @"UPDATE `UnitSelectTest2` SET
[Dc]=@Dc,[IntNull]=@IntNull WHERE [Int]=@Int", "Queryable"); `Dc`=@Dc,`IntNull`=@IntNull WHERE `Int`=@Int", "Queryable");
sql = Db.Queryable<Order>().IgnoreColumns(it => it.CreateTime).ToSql().Key; sql = Db.Queryable<Order>().IgnoreColumns(it => it.CreateTime).ToSql().Key;
UValidate.Check(sql, "SELECT [Id],[Name],[Price],[CustomId] FROM `order` ", "Queryable"); UValidate.Check(sql, "SELECT `Id`,`Name`,`Price`,`CustomId` FROM `Order` ", "Queryable");
sql = Db.Queryable<Order>().IgnoreColumns(it => new { it.Id, it.Name }).ToSql().Key; sql = Db.Queryable<Order>().IgnoreColumns(it => new { it.Id, it.Name }).ToSql().Key;
UValidate.Check(sql, "SELECT [Price],[CreateTime],[CustomId] FROM `order` ", "Queryable"); UValidate.Check(sql, "SELECT `Price`,`CreateTime`,`CustomId` FROM `Order` ", "Queryable");
sql = Db.Queryable<Order>().IgnoreColumns("id").ToSql().Key; sql = Db.Queryable<Order>().IgnoreColumns("id").ToSql().Key;
UValidate.Check(sql, "SELECT [Name],[Price],[CreateTime],[CustomId] FROM `order` ", "Queryable"); UValidate.Check(sql, "SELECT `Name`,`Price`,`CreateTime`,`CustomId` FROM `Order` ", "Queryable");
var cts = IEnumerbleContains.Data(); var cts = IEnumerbleContains.Data();
var list2=Db.Queryable<Order>() var list2=Db.Queryable<Order>()

8
Src/Asp.Net/SqliteTest/UnitTest/Updateable.cs

@ -43,16 +43,16 @@ namespace OrmTest
{ {
IsRemind = saveDiary.IsRemind, IsRemind = saveDiary.IsRemind,
}).Where(it => it.ID == saveDiary.ID).ToSql(); }).Where(it => it.ID == saveDiary.ID).ToSql();
UValidate.Check(sql.Key, @"UPDATE [Diary] SET UValidate.Check(sql.Key, @"UPDATE `Diary` SET
[IsRemind] = @Const0 WHERE ( [ID] = @ID1 )", "Updateable"); `IsRemind` = @Const0 WHERE ( `ID` = @ID1 )", "Updateable");
sql = Db.Updateable<UnitDiary>().SetColumns(it => new UnitDiary() sql = Db.Updateable<UnitDiary>().SetColumns(it => new UnitDiary()
{ {
TypeID = saveDiary.TypeID, TypeID = saveDiary.TypeID,
}).Where(it => it.ID == saveDiary.ID).ToSql(); }).Where(it => it.ID == saveDiary.ID).ToSql();
UValidate.Check(sql.Key, @"UPDATE [Diary] SET UValidate.Check(sql.Key, @"UPDATE `Diary` SET
[TypeID] = @Const0 WHERE ( [ID] = @ID1 )", "Updateable"); `TypeID` = @Const0 WHERE ( `ID` = @ID1 )", "Updateable");
} }
} }

Loading…
Cancel
Save