如何调用hotchocaly azure函数隔离/程序外的hotchocaly的useendpoints()和mapgraphql()?
代码> mapgraphql()?我只能访问iHost
:
public class Program
{
public static void Main()
{
var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
.ConfigureServices(s =>
{
s.AddTransient<IUserRepository, UserRepository>();
s.AddSingleton<GraphQLAzureFunctionsExecutorProxyV12>();
s.AddGraphQLServer()
.AddQueryType<Query>()
.AddFiltering()
.AddSorting();
}).Build();
host.Run();
}
}
I follow this repo https://github.com/chandsalam1108/GraphQLAzFunctionNet5 and https://chillicream.com/docs/hotchocolate/server/endpoints#mapgraphql
How do I call MapGraphQL()
? I only have access to IHost
:
public class Program
{
public static void Main()
{
var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
.ConfigureServices(s =>
{
s.AddTransient<IUserRepository, UserRepository>();
s.AddSingleton<GraphQLAzureFunctionsExecutorProxyV12>();
s.AddGraphQLServer()
.AddQueryType<Query>()
.AddFiltering()
.AddSorting();
}).Build();
host.Run();
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
作为版本13的Hotchocaly预览,没有模式支持。因此,您可以使用此非常兼容的lib:
然后像平常一样设置模式名称,就像您在
addgraphqlserver(“ schemaname”)中所做的
一样
如果切换到程序内使用Azure函数,则可以使用此。
As version 13 preview of HotChocolate there is no support for schemas. So instead you can use this very compatible lib:
Then setup the schema name as you normally would do in
AddGraphQLServer("schemaName")
:Then in your function use IMultiSchemaRequestExecutor
If you switch to use Azure Function in-process, instead you can use this equivalent.
hotchocaly(版本13.0.5)的最新稳定版本盒子支持孤立的过程Azure在.NET 6.0及更高版本中功能。您需要通过从终端运行以下命令来安装其模板的最新版本:
完成后,您可以使用
Hotchocaly GraphQl函数隔离
模板创建一个新项目。这将自动引导您的Azure隔离过程功能应用程序使用GraphQl。查看此视频以获取有关如何执行此操作的更多详细信息:“ nofollow noreferrer”> serverless graphql
The latest stable version of HotChocolate (version 13.0.5) has out of the box support for Isolated Process Azure functions in .Net 6.0 and above. You need to install the latest version of their templates by running the following command from your terminal:
Once that is done, you can create a new project using the
HotChocolate GraphQL Function Isolated
template. This will automatically bootstrap your Azure Isolated Process function application to use GraphQL.Check out this video for more detailed info about how to do this: Serverless GraphQL with Hot Chocolate and Azure Functions
IHOST用于构建无头服务,并用于控制台应用程序。
在端点上使用
mapgraphql()
时,将有助于获取和发布请求。IHOST用于创建应用程序将运行的主机。
请参阅此 acrats 史蒂夫·戈登
Ihost is used to build headless services and is used on a console application.
While using
MapGraphQL()
on an endpoint will help get and post requests.Ihost is used to create host on which the app will run.
refer this article by STEVE GORDON