.NET 3.5, Download, LINQ

LINQ Material

The presentation made available for download through this post is in swedish. The code however is “international”. First of I would like to list what I think are two of the best getting started with LINQ resources available online.

With that said, the material provided here is the LINQ presentation and demo code that I used for the LINQ presentation I held.

Presentation: The mechanics of LINQ.pptx (in swedish)
Code: linqdemo.zip

.NET 3.5, BizTalk, Download, LINQ

LINQ in BizTalk – Follow up

I’ve previously posted my ideas about using LINQ in BizTalk. At that point it was just theories, and following the links in the comments section of that post I wasn’t the first to have them. Thanks to the red bits/green bits approach BizTalk Server can use LINQ today by using Visual Studio 2008 side-by-side with Visual Studio 2005. This post provides a working sample that does just that – uses LINQ in BizTalk by utilizing a helper assembly, built using Visual Studio 2008 and the .NET Framework 3.5, from a BizTalk Server 2006 R2 Orchestration (built using Visual Studio 2005). If you do have both Visual Studio 2005 and 2008 available, and this doesn’t conflict with the rules of engagement you have as far as your environment goes, I think it’s worth looking at.

The sample consist of the following parts:

  1. A library project named LINQHelperLibrary, with a method that takes in a XLangMessage, extracts the stream, wraps the stream in an XmlReader and feeds that into the constructor for an XElement. Using that XElement a LINQ to XML statement is performed to extract the totalt amount of a Purchase Order document. This library is built using Visual Studio 2008 and the .NET Framework 3.5 compiler.

  2. A BizTalk project named BizTalkLINQ, that contains a generated xsd schema and a very simple orchestration with an expression shape that calls the LINQHelperLibrary and passes in the message, receives the response and outputs a Trace.WriteLine. This project has a reference to LINQHelperLibrary as well as (an explicitly added) reference to System.Xml.Linq.

The sample requires the following:

  • BizTalk Server 2006 (I used R2)

  • Visual Studio 2005

  • .NET 2.0 and .NET 3.5

  • I am including the dll built using Visual Studio 2008, but if you wan’t to build it yourself you’ll need Visual Studio 2008.

To run the sample do the following:

  1. GAC LINQHelperLibrary.dll. (If you want to build it yourself do so using Visual Studio 2008 first)

  2. Build and Deploy BizTalkLINQ.

  3. Configure the orchestration by assigning it a host instance, a receive and a send port (use the XML pipeline).

  4. Feed a Purchase Order document into the Receive Port. A sample file is included in the sample (in the BizTalk LINQFileDrop folder)  – it originates from Sample XML File: Purchase Order in a namespace.

  5. Optionally display the value returned by the helper assembly by using DebugView while it runs. If you don’t there really isn’t muc to see…

Note: This isn’t a LINQ to BizTalk implementation – implementing a provider for BizTalk is a totally different matter, this just uses LINQ to XML from within BizTalk.

Download: biztalklinq.zip

.NET 3.5, BizTalk, LINQ

LINQ in BizTalk?

Intriguing title, and I think it can be done. It might not be practical, not yet. We’ll get there eventually. But for now…

There are ways to utilize many of the C# 3.0 features in 2.0, even extension methods, and there is even a LINQ library that allows you to do LINQ to objects in .NET 2.0. However these approaches still requires Visual Studio 2008 (or rather the C# 3.5 compiler), since they make use of Visual Studios multi-targeting features. And if you have to use Visual Studio 2008 there is really no point in not using .NET 3.5. But BizTalk doesn’t work with VS.NET 2008 yet. At least not the Visual part. There should however not be anything stopping you from building for example pipeline components or functoids with Visual Studio 2008. The way I’ve understood it, it’s “only” the designers and project templates that are missing. And since Visual Studio 2008 functions side-by-side with Visual Studio 2005, it’s totally plausible to do one type of development in one tool and the other in another. Not very practical though. I’m guessing we have to wait quite awhile to get VS.NET 2008 support. Information about when this will be is scarce, about the only thing I’ve found is below.

From Paul Somers blog (Pauls blog seems to frequently use more resources than allowed and can at times not be viewed, so I am choosing to reproduce part of it here. The blogpost itself seems to be quoting someone else, but I couldn’t say whom or what)
With the launch of Windows Server 2008, SQL Server 2008 and Visual Studio 2008 right around the corner, a number of you have asked when you will be able to take advantage of the new platforms with BizTalk Server.  We are currently investigating various options to deliver updates prior to Oslo. As we have done historically, this would follow the RTM of Windows Server and SQL Server.  This will give us time to do the final work and testing to ensure compatibility.  Our intent is to provide an integrated release that supports the updated Tools (Visual Studio 2008), OS (Windows Server 2008) and DB (SQL Server 2008) as part of an infrastructure update.

To me this suggest availability at the earliest somewhere in Q4 2008, if we’re lucky, since at the moment SQL 2008 is planned for Q3. This will probably happen through a SP1 for BizTalk Server 2006 and R2. And based on the above that release will be much larger then just tools, or even .NET 3.5, compliance.

With all that said, although I think LINQ and the new language features are cool, I can’t really say it’s something that I am really missing in BizTalk development. Being able to run BizTalk on Windows Server 2008 utilizing SQL Server 2008 excites me more then getting access to LINQ. Oh, and don’t take this post as stating truths, it’s just my 5 cents as it stands right now.

[Edit: For an example of using LINQ to XML in a helper class from an Orchestration, view my post here.]

General, LINQ, Readings, SOA

Snow and LINQ

For those of you wondering where I’ve been – I’ve been on vacation for the last 10 days, skiing and snowboarding. Although slightly of topic for this blog I just have to share one of the pictures we took with you, to give you an idea of the wonderful snow and weather we had. And yes, that’s me in the midst of that snow. And no, I’m not about to fall, we just had alot of snow.

For those who know me, you know I like to bring some litterature along on my vacations to catch up on some topic of interest. This time that topic was LINQ and the reading was the free ebook from Microsoft press: Introducing Microsoft LINQ. Go here for details about the book and the free ebook offer. I’ve listened in on presentation about LINQ before, but not lately, and they have never gone deeper than to show the grace of the syntax, and talk about why LINQ was developed and what you can do with it. The ebook also talks about the language syntax and background, but goes into more detail about the .NET language features that enables LINQ, and their history and evolution. Good stuff.

Of the different aspects I’ve learned about LINQ I most like the idea of LINQ as a SOA enabler, rather than a simple data access language. Being able to do join, where, etc. on data returned from different Services being called in parallell, all wrapped up in a simple functional statement. That’s where LINQ really becomes useful.