[dba-VB] FYI: LINQ: Building an IQueryable provider articles series + MS Access LINQ (IQueryable) provider...

Salakhetdinov Shamil mcp2004 at mail.ru
Sat Jun 23 17:03:36 CDT 2012


Hi All --

FYI: I have occasionally get at the subject articles series here: http://blogs.msdn.com/b/mattwar/archive/2008/11/18/linq-links.aspx and from them I have got here LINQ IQueryable Toolkit (http://iqtoolkit.codeplex.com/) and I have got surprised finding that LINQ IQueryable Toolkit is able to handle MS Access backends (as well as SqlCE, SQLLite, MySQL and MS SQL). As you can guess it means that LINQ IQueryable Toolkit allows to have different backend types handled (CRUD and data retrieval) by the same code

For example the following code will list ContactName, OrderDate and ProductName for all the orders of a customer with CustomerID = "ALFKI": 

Northwind db = new Northwind(
        DbEntityProvider.From(TestConstants.ConnectionString, TestConstants.MappingId));

var list = (
    from c in db.Customers
    from o in db.Orders
    from d in db.OrderDetails
    where  c.CustomerID == "ALFKI" &&
            o.CustomerID == c.CustomerID && 
            o.OrderID == d.OrderID
    select new
    {
        c.ContactName,
        o.OrderDate,
        d.Product.ProductName  
    }
    ).ToList();

list.ForEach(System.Console.WriteLine);


For the case of MS Access backend  TestConstants.ConnectionString equals to the path to the test database "C:\Data\\Northwind.mdb",
for the case of SqlCE - to the test database "c:\data\Northwind.sdf"
etc. (see http://iqtoolkit.codeplex.com/)

and TestConstants.MappingId defines the name of ORM attributes class (it has to be prepared manually for a given backend)...

LINQ IQueryable Toolkit is not officially supported by Microsoft but developed by an MS employee Matt Warren (http://blogs.msdn.com/b/mattwar/ , http://www.devtopics.com/blogs-from-microsoft-c-development-team/ ) ...

As far as I have also found LINQ IQueryable Toolkit is rather mature software and it was recently used for LINQPad - as part of   "IQ Driver - for MySQL, SQLite, Oracle" -   http://www.linqpad.net/RichClient/DataContextDrivers.aspx ...

Thank you.

-- Shamil




More information about the dba-VB mailing list