有没有可能在SubSonic3中做这样的事情?
_db.Update<Product>()
.Set("UnitPrice")
.EqualTo(UnitPrice + 5)
.Where<Product>(x=>x.ProductID==5)
.Execute();我需要像这样的东西:
UPDATE Blocks
SET OrderId = OrderId - 1
WHERE ComponentId = 3但在SubSonic3中
发布于 2010-02-22 20:07:06
我想你可以在这里演示如何使用subsonic 3。
//使用Linq To Sql可能没有看到的一件事是运行更新//和插入的能力,这是我一直错过的,现在已经用SubSonic 3.0实现了:
db.Update<Products>().Set(
x => x.Discontinued == false,
x => x.ReorderLevel == 100)
.Where(x=>x.Category==5)
.Execute();
db.Insert.Into<Region>(x => x.RegionID, x => x.RegionDescription)
.Values(6, "Hawaii")
.Execute();这里是完整演示的link
发布于 2010-02-24 06:06:03
我这样做是因为我选择了
var model = ClassName.SingleOrDefault(x => x.id == 1);
model.name = "new name";
model.tel = " new telephone;
model.save();完成
https://stackoverflow.com/questions/2266692
复制相似问题