ドメイン サービスのクエリ操作で .AsParallel() 拡張機能を使用すると、パフォーマンスの向上を期待できますか。DomainService は、リポジトリ (EntityFramework) を使用してデータをクエリし、クエリ操作によって返されるクライアントの ViewModel を構築します。
私の DomainService での簡単なクエリ操作は次のとおりです。
[Query]
public IQueryable<ProductViewModel> GetProductSet() {
var products = from product in _productRepository.Query()
select product;
return (from product in products.ToList()
select new ProductViewModel() { Product = product}).AsQueryable();
}
PLinq を使用して高速化できる場合、どこに .AsParallel() 呼び出しを追加すればよいですか?
ここ
_productRepository.Query().AsParallel();
そこには
products.AsParallel().ToList()
またはそこに
product.ToList().AsParallel()