Search code examples
c#restms-accessasp.net-web-apilinqpad

Can I use LINQPad on MS Access data directly, or by passing args to a Web API Rest method?


I want to test out the LINQ in my Repository code:

public IEnumerable<InventoryItem> Get(string ID, string packSize, int CountToFetch)
{
    return inventoryItems.Where(i => 0 < String.Compare(i.Id, ID)).Where(i => 0 < String.Compare(i.PackSize.ToString(), packSize)).Take(CountToFetch);
}

...and am trying to use LINQPad to do that.

The data comes from an MS Access database; seeing that LINQPad doesn't seem to support Access "out of the box" that way, I wonder if either there's a driver for that (couldn't fine one - don't have the DevExpress product needed to use their driver), or if I could query by attaching to my Web API Rest method inside LINQPad?

I tried the SQL Server driver, hoping that would work for Access, too; I tried the WCF driver, hoping maybe that would work with Web API, but neither worked; with the latter attempt, I got, "XmlException: Data at the root level is invalid. Line 1, position 1."


Solution

  • There is a 'Microsoft Access Data Context Driver' for LinqPad

    You can download it here: MSAccessDataContextDriver.lpx

    View a screenshot here: LinqPad Northwind.accdb

    UPDATE (5 Nov 2014) The driver now supports password protected MS Access databases