MissingLinq

MissingLinq is a .NET library containing hard to find Linq providers. Current Linq providers include:
  • Linq2Management: Linq provider for WMI.

Linq2Management

Linq2Mangement is a C# library that allows access to WMI object instances using Linq expressions. Queries are performed in the style of the Entity Framework using a context:

using MissingLinq.Linq2Management.Context;
using MissingLinq.Linq2Management.Model.CIMv2;

// access objects on the local computer
using(var mc = new ManagementObjectContext())
{
    // retrieve all shares
    var shares = mc.CIMv2.Win32Shares.ToList();
    foreach(var share in shares)
        System.Diagnostics.Debug.WriteLine(share.Name);

    // filter
    var drives = mc.CIMv2.Win32Shares.Where(s => s.Type == Win32ShareType.DiskDrive).ToArray();
    foreach(var drive in drives)
        System.Diagnostics.Debug.WriteLine(drive.Path);
}

// access objects on a remote computer
using(var rmc = new ManagementObjectContext("remotecomputername"))
{
   // do work
}



Highlights include:
  • Strongly typed access to WMI classes.
  • Context can be pointed to local (default) or remote computer.
  • Uses familiar Entity Framework conventions.
  • Available as NuGet package MissingLinq.Linq2Management

Currently supports:
  • Able to perform queries.
  • Where() method.
  • 850+ WMI classes in the root\CIMv2 namespace (e.g., Win32ACE, Win32LogicalDisk, etc).

Looking forward:
  • Ability to perform updates.
  • Support for methods like OrderBy, Select, etc.
  • Support for classes in other WMI namespaces.


Last edited Jul 9, 2013 at 7:25 PM by wimpleshapers, version 8