Exemple #1
0
        public async Task Update_SetObject_ST_02()
        {
            xx = string.Empty;

            // 要更新的 model 字段 赋值
            var model = new AgentInventoryRecord();

            model.TotalSaleCount = 1000;

            //
            var res1 = await MyDAL_TestDB
                       .Updater <AgentInventoryRecord>() //更新表 AgentInventoryRecord
                       .Set(new
            {
                model.TotalSaleCount, //  更新 字段 TotalSaleCount
                xxx = 2000            //  字段 xxx 在表中无对应 ,自动忽略
            })
                       .Where(it => it.Id == Guid.Parse("032ce51f-1034-4fb2-9741-01655202ecbc"))
                       .UpdateAsync();

            Assert.True(res1 == 1);



            /***************************************************************************************************************************/

            xx = string.Empty;
        }
Exemple #2
0
        public async Task Mock_UpdateAll_Shortcut()
        {
            xx = string.Empty;

            var model = new AgentInventoryRecord();

            model.LockedCount = 0;

            var res1 = await MyDAL_TestDB.UpdateAsync <AgentInventoryRecord>(it => true, new
            {
                model.LockedCount
            });

            Assert.True(res1 == 574);



            var res11 = await MyDAL_TestDB.SelectListAsync <AgentInventoryRecord>(it => it.LockedCount != 0);

            Assert.True(res11.Count == 0);

            xx = string.Empty;
        }