我有這樣的LINQ查詢,查詢保留做任何表中的任何改變歷史構造像這樣的表:工作LINQ查詢,但性能下降
History (Primary Key) | Table_Name | Primary_Key | Field_Name | Old_Value | New_Value | Action_Type | Action_Date | Action_User
LINQ查詢我有一個查詢該表是這樣的:
var complaintHistory = from histories in DbContext.Histories
where ((from c in taskIds
select "<Task_ID=" + c + ">").Contains(histories.Primary_Key) ||
(from c in notificationListIds
select "<Notification_List_ID=" + c + ">").Contains(histories.Primary_Key) ||
(from c in emailSentIds
select "<Email_Sent_ID=" + c + ">").Contains(histories.Primary_Key) ||
histories.Primary_Key == "<Complaint_ID=" + Complaint.Complaint_ID + ">") &&
histories.Field_Name != "rowversion"
select histories;
每當我調用這個查詢時,我都會有嚴重的延遲。這個linq查詢可以重新編寫以顯着提高性能嗎?還是我想在沒有槳的情況下去爬溪?
這對於http: //codereview.stackexchange.com/ –
哦?這個問題對於這個問題是不恰當的嗎? –
我有點困惑,因爲還有其他關於LINQ查詢優化的問題。 –