forked from JocaPC/sql-server-rest-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathODataChunked.cs
30 lines (28 loc) · 969 Bytes
/
ODataChunked.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using Belgrade.SqlClient.SqlDb;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Extensions.Logging;
using MsSql.RestApi;
using System;
using System.Threading.Tasks;
namespace TestFunction
{
public static class ODataChunked
{
[FunctionName("ODataChunked")]
public static async Task Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log)
{
try
{
var tableSpec = new TableSpec(schema: "sys", table: "objects", columns: "object_id,name,type,schema_id,create_date");
await req.OData(tableSpec).Process(Environment.GetEnvironmentVariable("SqlDb"));
}
catch (Exception ex)
{
log.LogError($"C# Http trigger function exception: {ex.Message}");
}
}
}
}