索引:html
目錄索引ui
一.API 列表spa
1.Set<M, F>(Expression<Func<M, F>> propertyFunc, F newVal)code
如: .Set(it => it.BodyMeasureProperty, "{xxx:yyy,mmm:nnn,zzz:aaa}") 用於 單表 指定字段更新htm
2.Set<M>(dynamic filedsObject)blog
用於 單表 指定多字段更新索引
二.API 單表-完整 方法 舉例-01get
1 // 多 字段 多 set 用法 2 var res1 = await Conn 3 .Updater<BodyFitRecord>() // 更新表 BodyFitRecord 4 .Set(it => it.CreatedOn, DateTime.Now) // 設置字段 CreatedOn 值 5 .Set(it => it.BodyMeasureProperty, "{xxx:yyy,mmm:nnn,zzz:aaa}") // 設置字段 BodyMeasureProperty 值 6 .Where(it => it.Id == m.Id) 7 .UpdateAsync();
以 MySQL 爲例,生成 SQL 以下:it
1 update `bodyfitrecord` 2 set `CreatedOn_col`=?CreatedOn_col_1, 3 `BodyMeasureProperty`=?BodyMeasureProperty_2 4 where `Id`=?Id_3;
三.API 單表-完整 方法 舉例-02io
1 // 2 var res1 = await Conn 3 .Updater<AgentInventoryRecord>() // 更新表 AgentInventoryRecord 4 .Set(new 5 { 6 TotalSaleCount = 1000, // 更新 字段 TotalSaleCount 7 xxx = 2000 // 字段 xxx 在表中無對應 , 自動忽略 8 }) 9 .Where(it => it.Id == Guid.Parse("032ce51f-1034-4fb2-9741-01655202ecbc")) 10 .UpdateAsync();
以 MySQL 爲例,生成 SQL 以下:
1 update `agentinventoryrecord` 2 set `TotalSaleCount`=?TotalSaleCount_1 3 where `Id`=?Id_2;
四.API 單表-完整 方法 舉例-03
1 // 要更新的 model 字段 賦值 2 var model = new AgentInventoryRecord(); 3 model.TotalSaleCount = 1000; 4 5 // 6 var res1 = await Conn 7 .Updater<AgentInventoryRecord>() //更新表 AgentInventoryRecord 8 .Set(new 9 { 10 model.TotalSaleCount, // 更新 字段 TotalSaleCount 11 xxx = 2000 // 字段 xxx 在表中無對應 ,自動忽略 12 }) 13 .Where(it => it.Id == Guid.Parse("032ce51f-1034-4fb2-9741-01655202ecbc")) 14 .UpdateAsync();
以 MySQL 爲例,生成 SQL 以下:
1 update `agentinventoryrecord` 2 set `TotalSaleCount`=?TotalSaleCount_1 3 where `Id`=?Id_2;
蒙
2019-04-12 17:27 週五