Home

Writing a Driver for a webservice that accepts TSQL

Hi,

I have a web-service that exposes an endpoint to accept TSQL queries. I would like to build a custom driver for that web-service. Is there a way I can use SQL language from Linqpad to talk to that webservice? Basically, I'll relay the TSQL to the webservice end-point, which will return csv data that I'll parse into an entity. I have been struggling with the dynamic linqpad driver sample which explains how to talk to a dataservicecontext but does not allow so using SQL language in linqpad.

Thanks,

Comments

  • You won't be able to set the language to 'SQL' and relay the query because LINQPad will try to execute the SQL using the ADO.NET provider that you return in GetProviderFactory or GetIDbConnection.

    However, you should be able to set the language to 'ESQL' if you override ExecuteESqlQuery in your driver. ExecuteESqlQuery is intended for executing Entity Framework ESQL queries but there's no reason why you can't make it do whatever you like. For example:
    public override void ExecuteESqlQuery (IConnectionInfo cxInfo, string query)
    {
       "Foo".Dump();
    }
Sign In or Register to comment.