C# 如何为所有查询请求永久启用Apollo跟踪和热巧克力?
使用.Net Core时,我创建的方案如下:C# 如何为所有查询请求永久启用Apollo跟踪和热巧克力?,c#,.net,.net-core,graphql,hotchocolate,C#,.net,.net Core,Graphql,Hotchocolate,使用.Net Core时,我创建的方案如下: public class Startup { public void ConfigureServices(IServiceCollection services) { // Here I register my services / repositories; omitted for brevity services.AddGraphQL(sp => Schema.Create(c =>
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// Here I register my services / repositories; omitted for brevity
services.AddGraphQL(sp => Schema.Create(c =>
{
// Here I register my schema types and so on; omitted for brevity
}));
}
// Code omitted for brevity
}
但实际上,我如何为所有请求启用内置的Apollo跟踪呢?它与.Net Framework的工作方式是否相同?基本上是通过将
tracingpreserve
选项设置为tracingpreserve.Always
下面的代码片段显示了这种情况
services.AddGraphQL(sp => Schema.Create(c =>
{
// Here goes the schema definition which is omitted for brevity purpose
}),
new QueryExecutionOptions
{
TracingPreference = TracingPreference.Always
});
是的,它在.NETFramework中也以同样的方式工作。Net核心和框架中的API保持相同,比如说99%相同。这里不同的只是周围环境,这意味着封装DI配置的启动类
有关阿波罗追踪的更多信息,请浏览