After an evening of mucking around with this I was able to
get LINQ to SQL to work with my custom provider. The process
involved is actually quite simple, although it’s not real
obvious to discover. LINQ to SQL doesn’t have any explicit
support for plugging in new providers (unfortunately)
however, you CAN pass it an instance of a Connection object
like this:
WebRequestConnection conn = new WebRequestConnection(); // my custom provider’s Connection class
conn.ConnectionString = "Data Source=http://rasnote/PraWeb/DataService.ashx;uid=ricks;pwd=secret";
TimeTrakkerDataContext context = new TimeTrakkerDataContext(conn);
Here I create an instance of my custom provider’s
WebRequestConnection() class, set its connection string and
pass it to the constructor of the DataContext. And lo and
behold – assuming your provider is compatible with SQL
syntax and implements the DbProvider classes properly LINQ
to SQL works using the custom provider.