使用LINQ和ASP.NET MVC更新多个表 [英] Updating multiple tables with LINQ and ASP.NET MVC
本文介绍了使用LINQ和ASP.NET MVC更新多个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
真的很简单,我只是想澄清一下.
Just a quick one really, I'm just looking for a bit of clarification.
我正在尝试通过一个创建"操作来更新多个表,在尝试之前,我只是想知道是否可以简单地执行以下操作:
I'm looking to update multiple tables from one "Create" action, before I try it, I was just wondering if it's possible to simply just do the following:
db.hdCalls.InsertOnSubmit(a)
db.hdCustomers.InsertOnSubmit(b)
db.hdAssign.InsertOnSubmit(c)
db.SubmitChanges()
还是比这稍微复杂一点?
Or is it slightly more complicated than that?
推荐答案
是的,SubmitChanges随后将调用3次插入.
Yes, SubmitChanges will then call 3 inserts.
这篇关于使用LINQ和ASP.NET MVC更新多个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文