Azure functions Azure函数返回IQueryable
我想在Azure函数上构建API,但需要将Iqueryable与entityframework一起使用 可以从azure函数返回IQueryable吗?可以Azure functions Azure函数返回IQueryable,azure-functions,Azure Functions,我想在Azure函数上构建API,但需要将Iqueryable与entityframework一起使用 可以从azure函数返回IQueryable吗?可以 using System; using System.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http;
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System.Linq;
using System.Collections.Generic;
namespace FunctionApp12
{
public static class Function1
{
private static SortedDictionary<string, string> _dataValue;
[FunctionName("Function1")]
public static IQueryable<object> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
_dataValue = new SortedDictionary<string, string>();
_dataValue.Add("test1", "This is test1.");
IQueryable<object> query = _dataValue.AsQueryable().Select(r => r.Value);
log.LogInformation("This is a test.");
return query;
}
}
}
使用系统;
使用System.IO;
使用System.Threading.Tasks;
使用Microsoft.AspNetCore.Mvc;
使用Microsoft.Azure.WebJobs;
使用Microsoft.Azure.WebJobs.Extensions.Http;
使用Microsoft.AspNetCore.Http;
使用Microsoft.Extensions.Logging;
使用Newtonsoft.Json;
使用System.Linq;
使用System.Collections.Generic;
命名空间函数pp12
{
公共静态类函数1
{
私有静态分类字典_数据值;
[功能名称(“功能1”)]
公共静态IQueryable运行(
[HttpTrigger(AuthorizationLevel.Function,“get”,“post”,Route=null)]HttpRequest请求,
ILogger日志)
{
_dataValue=新的SortedDictionary();
_Add(“test1”,“这是test1”);
IQueryable query=\u dataValue.AsQueryable().Select(r=>r.Value);
log.LogInformation(“这是一个测试”);
返回查询;
}
}
}
点击端点,您将获得:
是的,你可以
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System.Linq;
using System.Collections.Generic;
namespace FunctionApp12
{
public static class Function1
{
private static SortedDictionary<string, string> _dataValue;
[FunctionName("Function1")]
public static IQueryable<object> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
_dataValue = new SortedDictionary<string, string>();
_dataValue.Add("test1", "This is test1.");
IQueryable<object> query = _dataValue.AsQueryable().Select(r => r.Value);
log.LogInformation("This is a test.");
return query;
}
}
}
使用系统;
使用System.IO;
使用System.Threading.Tasks;
使用Microsoft.AspNetCore.Mvc;
使用Microsoft.Azure.WebJobs;
使用Microsoft.Azure.WebJobs.Extensions.Http;
使用Microsoft.AspNetCore.Http;
使用Microsoft.Extensions.Logging;
使用Newtonsoft.Json;
使用System.Linq;
使用System.Collections.Generic;
命名空间函数pp12
{
公共静态类函数1
{
私有静态分类字典_数据值;
[功能名称(“功能1”)]
公共静态IQueryable运行(
[HttpTrigger(AuthorizationLevel.Function,“get”,“post”,Route=null)]HttpRequest请求,
ILogger日志)
{
_dataValue=新的SortedDictionary();
_Add(“test1”,“这是test1”);
IQueryable query=\u dataValue.AsQueryable().Select(r=>r.Value);
log.LogInformation(“这是一个测试”);
返回查询;
}
}
}
点击端点,您将获得: