Browse Source

Update demo

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

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

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

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

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

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

@ -39,18 +39,18 @@ namespace OrmTest
DcNull = it.Dc,
Dc = it.Int
}).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;
UValidate.Check(sql, @"UPDATE [UnitSelectTest2] SET
[Dc]=@Dc,[IntNull]=@IntNull WHERE [Int]=@Int", "Queryable");
UValidate.Check(sql, @"UPDATE `UnitSelectTest2` SET
`Dc`=@Dc,`IntNull`=@IntNull WHERE `Int`=@Int", "Queryable");
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;
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;
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 list2=Db.Queryable<Order>()

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

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

Loading…
Cancel
Save