したがって、iQueryablesはSQL文に変換されるため、where句に入れる可能性のあるすべてのメソッドを処理することはできません。エンティティのIQueryable .Where(プロパティはローカル配列にあります)
しかし、これは私がやろうとしているものです:
int[] alreadySelectedIds = ...
var subjects = Entities.NewInstance.Subjects.Where(x => Array.IndexOf(alreadySelectedIds, x.Id) == -1).ToList();
そして、以下のようにこれらの記事を読んで、私はEF5がこれを翻訳することができるはず慰めです。
Getting Entities whose keys match list(or array) of ids
しかし、私はこのエラーを取得しています:
LINQ to Entities does not recognize the method 'Int32 IndexOf[Int32](Int32[], Int32)' method, and this method cannot be translated into a store expression.
をし、このエラーをグーグルでは、私に多くの助けを与えるものではありません。
私がこだわっていると私の脳は、優雅な回復のいずれかのタイプの可能性を超えてどろどろになっている
var newSubjects = Entities.NewInstance.Subjects.Where(x => alreadySelectedIds.Contains(x.Id)).ToList();
Unable to create a null constant value of type 'System.Int32[]'. Only entity types, enumeration types or primitive types are supported in this context.
と
List<int> alreadySelectedIds = ...
Unable to create a null constant value of type 'System.Collections.Generic.List`1'. Only entity types, enumeration types or primitive types are supported in this context.
をも試してみました。誰も私を助けてくれますか?
それは人間が問題の理解を修正するためのパスは絶望と知的パニックの中で失われているという理由だけで、簡単な問題で無駄に苦労することができますどのように、非常に素晴らしいです。しかし、人は何ができるのですか? – Alex
@Alexはコンピュータサイエンスのためのあまりにも多くの哲学;)しかし、...確かに! –