Sunday, April 22, 2007 4:43 PM
bart
LINQ to SharePoint - 0.1.2.0 Alpha release available now
It's been a long ten days since the first announcement of the LINQ to SharePoint project, with lots of implementation and testing work but tonight I'm very excited to announce the availability of the first public alpha of the LINQ to SharePoint project. A few highlights of this release:
- Supports writing LINQ queries for SharePoint lists in both C# 3.0 and Visual Basic 9.0
- The SpMetal entity type creation tool supports both C# 3.0 and Visual Basic 9.0
- Talks to SharePoint over web services or though the SharePoint Object Model
- Most CAML query constructs are available via LINQ
The current alpha release is built for the Orcas March 07 CTP. An update for Orcas Beta 1 will follow later.
For more information, visit the following pages:
Warning: This release is an alpha release; use it at your own risk. You shouldn't use the alpha release in any production environment whatsoever.
A little sample of a (very simple) LINQ to SharePoint query in C# and VB:
C# 3.0 LINQ-to-SharePoint query
1 var users = new SharePointDataSource<User>(new Uri("http://wss.mycompany.local"));
2
3 var res = from u in users
4 orderby u.Birthdate descending
5 where u.FirstName.StartsWith("B") && u.Age >= 24 && u.FavoriteFood == FavoriteFood.Pizza
6 select new { u.FullName, u.Age, Interest = u.AccountBalance * 0.07 };
7
8 foreach (var u in res)
9 Console.WriteLine(u);
10
VB 9.0 LINQ-to-SharePoint query
1 Dim users As New SharePointDataSource(Of User)(New Uri("http://wss.mycompany.local"))
2
3 Dim res = From u In users _
4 Order By u.Birthdate Descending _
5 Where u.FirstName.StartsWith("B") And u.Age >= 24 And u.FavoriteFood.Value = FavoriteFood.Pizza _
6 Select u.FullName, u.Age, Interest = u.AccountBalance.Value * 0.07
7
8 For Each u In res
9 Console.WriteLine(u)
10 Next
Much more complicated queries are supported though, allowing you to focus on the query itself rather than on the CAML plumbing. A list of a few complexities that LINQ-to-SharePoint can deal with:
- Recursive parsing of query trees and translation of boolean negation into normal forms using De Morgan's laws.
- Analysis of projection operations to create a list of required fields in the query to reduce bandwith.
- Condition analysis and validation required for translation to supported CAML constructs.
- Nullable type support language differences between VB and C#.
- MultiChoice-to-enum mapping and support for fill-in choices.
- Visual Basic's runtime libraries for string comparisons.
Please report any issues with the software via the project website. You feedback is highly appreciated!
Enjoy!
Del.icio.us |
Digg It |
Technorati |
Blinklist |
Furl |
reddit |
DotNetKicks
Filed under: IW stuff - Office, SharePoint, IBF, C# 3.0, Orcas, LINQ