コードを実行すると:
public List<T> GetCustomerTxList(int customerId)
{
var matchingPocos = new List<T>();
using (linq.AOMSEntities dataRepos = new linq.AOMSEntities())
{
IEnumerable txlist = from t in dataRepos.TransactionRecord
where t.CustomerReference.Value.Id == customerId
select t;
foreach (EntityObject entity in txlist)
{
matchingPocos.Add(entity.ConvertToPoco<T>());
}
}
return matchingPocos;
}
次の例外が発生します:Data.Repository.Integration.Test.LinqRepositoryTest.GetCustomerTxList:System.NotSupportedException:指定されたタイプメンバー'CustomerReference'はLINQtoEntitiesでサポートされていません。初期化子、エンティティメンバー、およびエンティティナビゲーションプロパティのみがサポートされます。
CustomerReferenceは、Customerエンティティを参照するTransactionRecordエンティティのEntityReferenceです。
エンティティ参照を使用してクエリできないのはなぜですか?
そのようなクエリを実行するために推奨されるアプローチは何ですか?
それが役に立ったら、私は喜んでより多くの情報/コードを提供します。