我想看看我的插入语句会是什么样子,就好像我正在连接一个基于文本的 ADO.NET 命令一样。我该怎么做呢?
我一直在关注以下链接:
http://damieng.com/blog/2008/07/30/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers
并将 DebugTextWriter 类添加到我的项目中。所以,现在,在我的代码中,我有以下内容并没有真正做任何事情,我认为它不正确:
using(WorkbookDataContext dc = _conn.GetContext())
{
if(profile.ProfileId > 0)
{
dc.Profiles.Attach(profile, true);
}
else
{
dc.Profiles.InsertOnSubmit(profile);
}
dc.Log = new DebugTextWriter();
#if DEBUG
dc.Log = new System.IO.StreamWriter("linq-to-sql.log")
{
AutoFlush = true
};
#endif
dc.SubmitChanges();
}
任何想法我做错了什么和/或如何正确检查我的 LINQ 插入语句?
谢谢