LINQ中的DataContext SubmitChanges [英] DataContext SubmitChanges in LINQ

查看:110
本文介绍了LINQ中的DataContext SubmitChanges的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在不确定数据是否已更改时调用SubmitChanges()是否安全?它实际上是做什么的?

Is it safe to call SubmitChanges() when you are not sure whether the data has changed? What does it actually do?

推荐答案

这是安全的,但您应该自己进行一些测试.我总是将DataContext的.Log属性设置为

It's safe, but you should do some testing yourself. I always set the .Log property on my DataContext to log to the debug window. You may discover that you're doing updates you didn't intend to because the data has changed in a way you didn't expect. It's always good to watch what SQL is being generated and how many database calls are happening.

这篇关于LINQ中的DataContext SubmitChanges的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆