.NET, LINQ, Open source, Sitecore

LINQ to Sitecore


We are here at TechEd EMEA 2008 in Barcelona and have just attended a really cool session by Bart De Smet (blog here) titled LINQ to Anything. As you can imagine, the talk was about writing Linq providers to any data sources. Bart has active projects on LINQ to ActiveDirectory and LINQ to Sharepoint which really gives a good understanding of what it involves writing a custom provider.

The really interesting question is, are anyone working on a LINQ to Sitecore project? or how about an template entity mapper (like to one in LINQ to Sharepoint)? Give me a shout if you are interested – maybe we can get a open source project going on the topic.

Standard

7 thoughts on “LINQ to Sitecore

  1. Chris Corcino says:

    Hi Mr. Eldblom,

    I am Chris Corcino, right now as a way to learn more about Sitecore and Linq, c# 3.5, and Expression Trees, others developers that work with me and I are working on a simple non production ready Linq for Sitecore. We are doing this for fun.

    I would love to participate if you open an OS project on the topic, however, I must clarify that our experience with Sitecore is limited.

  2. Open the 6.0 Sitecore.Kernel.dll in the .net reflector and take a look at the Sitecore.Linq.* namespace. Looks like they were already experimenting with it, I just can’t see how it should be used.

  3. Eldblom says:

    Thanks for your feedback 🙂

    The classes in Sitecore.Linq are merely LINQ to SQL representations of the Sitecore SQL database. Matt, I think you are right about the experimentation – these classes should probably never have been exposed by Sitecore. I would not like for any of us to call Sitecores SQL database directly.

    Mark, your DomainObjects project looks really nice, and could easily be extended with code generation. I’m not sure the architecture fits in with LINQ though, especially if we should lean towards the achitecture proposed by Microsoft in LINQ to SQL, and LINQ to Entities (and even in the LINQ to Sharepoint above). I think a unified design is vital for the usability in the framework.

    I totally agree that Sitecore should provide LINQ functionality, but can we really wait for Sitecore 7 (or 8)? What would be cool, would be an open source initiative supported by Sitecore itself to provide this functionality.

  4. We’ve discussed and tried to implement LINQ to Sitecore during the development of v6. Or at least I did. I’ve tried to accomplish what Ole and Jakob weren’t able to do. And by that time I was not yet working for Sitecore, so this is not a politic judgement.

    I implemented a direct connection, LINQ to SQL-like LINQ to Sitecore. And discovered immediatelly how ugly LINQ is implemented in .NET. You’ve to write your own parsing rules around the unclear AST which is generated by this bunch of extension method and lambda’s.

    So I tried to do this and at a certain point, I figured out that the best approach would be to create a SQL query, find an ID and ask the Sitecore DataManager to return me the actual item. So then I started runnign through this AST and finally after creating 8 classes, I was able to return a single item where I defined the where clause static. So I stopped. This took to much time.

    Later on I discussed my approach with Ole, he has done the same. We hoped that Microsoft would come with a less rough layer when LINQ to Entities came out. Unfortunatelly so far it seems to be rough as well. But it came to late for v6 anyway.

    Meanwhile I’ve been investigating what we should change to make maximum use of LINQ to Objects, so you got maximal syntax sugar. Ole approved my suggestions and most likely will it be implemented pretty soon.

    When you look at the upcoming releases, we’ll definitelly support new stuff like LINQ, like we’ve done always with the latest and coolest MS technologies. But in which way… ;)?!

    When you want to see my original project, please contact me. I’ll publish it under Sitecore Shared Source license.

  5. Pingback: Sitecore Fetch Squad » Blog Archive » LINQ to Sitecore

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s