[英]WCF OData performance improvement
I have following query which is taking a lot of time -我有以下查询需要很多时间 -
var allEmployees = (from e in context.Employees.Expand("Payroll/Customer")
.Expand("HR")
.Expand("Payroll1")
where e.IsActive
&& e.Payroll.EmployeeId== this.CurrentEmployee.EmployeeId
orderby e.Name
select e).ToArray();
Questions -问题 -
Please suggest请建议
The most important part is your Expand最重要的部分是您的展开
No, It's not possible to LINQ over WCF data services with Parallel LINQ .不,不可能使用 Parallel LINQ 通过 WCF 数据服务进行 LINQ。
The best way is to index over foreign keys of relations between customers and human resources and payroll tables最好的方法是索引客户与人力资源和工资表之间关系的外键
ToArray wont takes too long ToArray 不会花费太长时间
Use SQL profiler and SQL execution plan to improve your performance and find bottle necks使用 SQL 分析器和 SQL 执行计划来提高性能并找到瓶颈
Consider creating method on your service layer and use Select method to return only columns you need考虑在您的服务层上创建方法并使用 Select 方法仅返回您需要的列
Another best practice is using JSON format instead of using XML Serializer.另一个最佳实践是使用 JSON 格式而不是使用 XML Serializer。 It will decrease your response size up to 70%.它会将您的响应大小减少多达 70%。
Let me know if you want more information.如果您需要更多信息,请告诉我。
good luck祝你好运
I know the question has been asked a few years ago, but if my advices can help someone, here they are:我知道几年前有人问过这个问题,但是如果我的建议可以帮助某人,那么它们是:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.