私はこのクエリを持っています:
var newComponents = from ic in importedComponents
where !existingComponents.Contains(ic)
select ic;
importedComponentsおよびexistingComponentsタイプList<ImportedComponent>は であり、メモリ内にのみ存在します (データ コンテキストに関連付けられていません)。この例でimportedComponentsは、6,100 をわずかに超えるアイテムがあり、existingComponents511 のアイテムがあります。
このステートメントは完了するのに時間がかかりすぎています (どのくらいかかるかはわかりませんが、20 分後にスクリプトを停止します)。実行速度の改善なしで次のことを試しました:
var existingComponentIDs = from ec in existingComponents
select ec.ID;
var newComponents = from ic in importedComponents
where !existingComponentIDs.Contains(ic.ID)
select ic;
どんな助けでも大歓迎です。