public void Update() { var helper = Config.DbHelper; TbArea tb = new TbArea(helper); tb.Name = null; tb.Where(tb.Id == 1563).Update(); var db = helper.SingleById <DbArea>(1563); Assert.AreEqual(null, db.Name); List <string> list = new List <string>() { "aadd" }; TbArea tb1 = new TbArea(helper); tb.Name = string.Join("、", list); tb.Where(tb.Id == 1563).Update(); db = helper.SingleById <DbArea>(1563); Assert.AreEqual("aadd", db.Name); }
public void Update() { var helper = Config.DbHelper; TbArea tb = new TbArea(helper); tb.Name = null; tb.Where(tb.Id == 1563).Update(); var db = helper.SingleById <DbArea>(1563); Assert.AreEqual(null, db.Name); TbArea tb1 = new TbArea(helper); tb.Name = "aadd"; tb.Where(tb.Id == 1563).Update(); db = helper.SingleById <DbArea>(1563); Assert.AreEqual("aadd", db.Name); }
public void SelectTest() { TbArea tb = new TbArea(); tb.Where(tb.Id == 1); DoSelect(tb, true, true, true); DoSelect <DbArea, Area>(tb, true, true, true); tb.Clear(); tb.Where(tb.Level == 2); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); #region 类型 String 的操作 tb.Clear(); tb.Where(tb.NamePinyin.Lower() == "yazhou"); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.Upper() == "yazhou".ToUpper()); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.Contains("yazhou")); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.StartsWith("ya")); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.EndsWith("zhou")); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.SubString(0, 2) == "ya"); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.Trim() == "yazhou"); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.LTrim() == "yazhou"); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.RTrim() == "yazhou"); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); #endregion tb.Clear(); tb.Where(tb.AddingTime.Year() < 2019); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.AddingTime.Month() < 2019); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.AddingTime.Day() < 2019); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.AddingTime.Hour() < 2019); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.AddingTime.Minute() < 2019); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.AddingTime.Second() < 2019); DoSelect(tb, false, false, true); DoSelect <DbArea, Area>(tb, false, false, true); }
public async void SelectAsyncTest() { TbArea tb = new TbArea(Config.DbHelper); tb.Where(tb.Id == 1); await DoSelectAsync(tb, true, true, true); await DoSelectAsync <DbArea, Area>(tb, true, true, true); tb.Clear(); tb.Where(tb.Level == 2); await DoSelectAsync(tb, false, false, true); await DoSelectAsync <DbArea, Area>(tb, false, false, true); #region 类型 String 的操作 tb.Clear(); tb.Where(tb.NamePinyin.Lower() == "yazhou"); await DoSelectAsync(tb, false, false, true); await DoSelectAsync <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.Upper() == "yazhou".ToUpper()); await DoSelectAsync(tb, false, false, true); await DoSelectAsync <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.Contains("yazhou")); await DoSelectAsync(tb, false, false, true); await DoSelectAsync <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.StartsWith("ya")); await DoSelectAsync(tb, false, false, true); await DoSelectAsync <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.EndsWith("zhou")); await DoSelectAsync(tb, false, false, true); await DoSelectAsync <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.SubString(0, 2) == "ya"); await DoSelectAsync(tb, false, false, true); await DoSelectAsync <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.Trim() == "yazhou"); await DoSelectAsync(tb, false, false, true); await DoSelectAsync <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.LTrim() == "yazhou"); await DoSelectAsync(tb, false, false, true); await DoSelectAsync <DbArea, Area>(tb, false, false, true); tb.Clear(); tb.Where(tb.NamePinyin.RTrim() == "yazhou"); await DoSelectAsync(tb, false, false, true); await DoSelectAsync <DbArea, Area>(tb, false, false, true); #endregion }