开发者

Any performance improvements using PLinq in DomainService query operations

开发者 https://www.devze.com 2023-03-08 10:23 出处:网络
Can i expect any performance improvements if i use the .AsParallel() extension in the query operations of my domain service. The DomainService uses a Repository (EntityFramework) to query data and to

Can i expect any performance improvements if i use the .AsParallel() extension in the query operations of my domain service. The DomainService uses a Repository (EntityFramework) to query data and to build up ViewModels for the client that are returned by the query operations.

Here´s a simple query operation in my 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();
}

If i can speed up things using PLinq, where should i add the .AsParallel() call?

Here

_productRepository.Query().AsParallel();

There

products.AsPa开发者_StackOverflow中文版rallel().ToList()

or there

product.ToList().AsParallel()
0

精彩评论

暂无评论...
验证码 换一张
取 消