大家好我似乎有一個與LINQ的問題,我目前維護一個內部Intranet應用程序在工作,當保存日誌它現在似乎減慢,調試時我已經來了要意識到每次它保存一個日誌時,應用程序會暫停在這兩段代碼中。它確實保存了日誌,只是它的速度很慢,而且時間很慢。LINQ to SQL似乎在放緩應用程序
DataClassesDataContext dab = new DataClassesDataContext();
dab.SubmitChanges();
我的問題主要是,有沒有與給予任何形式的問題,可以降低應用程序的代碼,這兩個paticuler行任何已知問題?下面是用於插入完整的代碼,那些誰更好地理解也許可以更好地分析它,也許指正其中提前即時wrong.Thanks ...
DataClassesDataContext dab = new DataClassesDataContext();
newlog = new calllog();
newlog.shortdesc = txtshortdesc.Text;
calllog_description.Text ="*****" + Page.User.Identity.Name + " " + DateTime.Now.ToString()
+ " ***** " + "\r\n" + calllog_description.Text;
newlog.calllog_description = calllog_description.Text;
newlog.calllog_id = Convert.ToInt32(txtlogid.Text);
newlog.calllogrefno = calllogrefno.Text;
newlog.pr_id = Convert.ToInt32(pr_id.SelectedItem.Value);
newlog.st_id = Convert.ToInt32(st_id.SelectedValue);
newlog.product_id = Convert.ToInt32(product_id.SelectedValue);
newlog.dep_id = Convert.ToInt32(dep_id.SelectedValue);
newlog.log_assigneduser = Convert.ToInt32(log_assigneduser.SelectedValue);
newlog.client_id = Convert.ToInt32(DropDownList1.SelectedValue);
newlog.log_datetime = System.DateTime.Now;
newlog.log_user_id = this.Page.User.Identity.Name;
newlog.calllog_internal = calllog_internal.Checked;
newlog.notify_client = true;
newlog.notify_practise = true;
newlog.ct_id = Convert.ToInt32(ct_id.SelectedValue);
newlog.resolved = false;
dab.calllogs.InsertOnSubmit(newlog);
dab.SubmitChanges();
這似乎是LINQ to SQL:您是否檢查過正在SQL事件探查器中創建和檢查的SQL,以查看這是否是數據庫上的問題? – Richard 2010-09-03 10:12:16
只是一個簡短的提示:我知道它很混亂,但LINQ與LINQ to SQL完全不同; LINQ是一個更通用的概念(語言集成查詢),它不僅適用於SQL或特定的SQL方言,而且LINQ to SQL是一個非常具體的ORM庫,用於處理持久實體。還有Linq到對象,Linq到實體,Linq到XML等...... – 2010-09-03 11:32:33