1
0
mirror of https://github.com/Microsoft/sql-server-samples.git synced 2025-12-08 14:58:54 +00:00

Multiple changes due to SqlClient update

This commit is contained in:
Jovan Popovic
2017-03-20 21:49:19 +01:00
parent 568626f447
commit b67a2e1ffb
11 changed files with 195 additions and 38 deletions

View File

@ -0,0 +1,20 @@
using Belgrade.SqlClient.SqlDb;
using System.Net;
using System.Configuration;
using SqlServerRestApi;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
log.Info("Started execution...");
try{
string ConnectionString = ConfigurationManager.ConnectionStrings["azure-db-connection"].ConnectionString;
var sqlQuery = new QueryPipe(ConnectionString);
var tableSpec = new SqlServerRestApi.SQL.TableSpec("sys.objects", "object_id,name,type,schema_id,create_date");
return await req.CreateODataResponse(tableSpec, sqlQuery);
} catch (Exception ex) {
log.Error($"C# Http trigger function exception: {ex.Message}");
return new HttpResponseMessage() { Content = new StringContent(ex.Message), StatusCode = HttpStatusCode.InternalServerError };
}
}