Saturday, June 07, 2008

Bart De Smet is at it again… This time with LINQ to MSI…

B# .NET Blog - LINQ to MSI - Part 0 - Introduction

“Introduction

Lately I've been delivering talks entitled "LINQ to Anything", to be repeated this summer at TechEd Africa. The goal of those talks is to focus on LINQ from the extensibility point of view, in other words: how to write query providers like LINQ to AD or LINQ to SharePoint (amongst many others I should give credits like LINQ to Amazon). Obviously, I'm always looking to improve the content of the talk and as a firm believer in the "small is beautiful" approach, smaller samples that pinpoint the core of LINQ providers are always welcome.

Goals and non-goals of LINQ to MSI

Just like LINQ to AD, the goal of LINQ to MSI is to act as a sample. Although many people have mailed me already telling they absolutely love LINQ to AD and are productizing it, I have to stress the fact it's sample-level quality (which nevertheless can be very useful to extend upon). This being said, LINQ to AD and LINQ to SharePoint will get their promised updates some time in the near future (I keep a little vague on the scheduling I know, but both projects I'd categorize as "personal incubation projects" have spread their tangles into other projects I'm working on from time to time).

Where the sample distinguishes itself from LINQ to AD is in its approach:

  • We won't go down the IQueryable route.
  • We'll focus more on the structure of and cross-relationships between a query provider, entity objects, data collections and query objects.
  • There'll be less focus on implementing the query parser.

So how can MSI be queried? Well, MSIs are just little databases. …

To convince you it actually works, here's the output of the following piece of LINQ code (omitted the straight-forward foreach loop):

var msi = new MyMsi(@"C:\temp\PowerShell_Setup_x86.msi");
var res = from prop in msi.Properties select new { prop.Name, prop.Value };

Next time, we'll start by the plumbing of MSI interop to allow querying an MSI database from managed code. You'll see classes like MsiConnection, MsiCommand and MsiDataReader appear on the surface of the bloge. Stay tuned!”

I wish I were 1/10th as smart as some of the people I subscribe too… sigh…

Anyway… Bart De Smet is at it again, this time with LINQ to MSI. I can totally see how something like this could be useful. Tie this to a PowerShell Cmdlet…

No comments: