然后我比较关注的是用linq替代现有的功能的方案,比如动态条件查询的功能,现在linq的动态查询方法有2种:
1、Anders Hejlsberg 推荐的,也就是在LINQ samples里的.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1752078&SiteID=1
代码:
2、Wayward 也有另外的方案,详见
http://blogs.msdn.com/mattwar/archive/2006/05/10/594966.aspx
主要代码:
我比较喜欢后者。
另外 Rico 针对linq to sql 做了一系列的性能分析,总体结论是linq性能不错,有些地方甚至比ado.net还要好。
with linq
select
update
insert
original
select
compiled
select
update
compiled
update
insert
The units for all of the above are test iterations per second so bigger is better.
| dlinq | nolinq | ratio | ||
| select | 495.32 | 924.79 | 53.56% | |
| compiled select | 860.59 | 924.79 | 93.06% | |
| update | 20.67 | 4.92 | 420.19% | (DLinq is faster) |
| compiled update | 20.71 | 4.92 | 421.00% | (DLinq is faster) |
| insert | 16.12 | 4.57 | 352.66% | (DLinq is faster) |