Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何为所有查询请求永久启用Apollo跟踪和热巧克力?_C#_.net_.net Core_Graphql_Hotchocolate - Fatal编程技术网

C# 如何为所有查询请求永久启用Apollo跟踪和热巧克力?

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 =>

使用.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 =>
        {
            // 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配置的启动类

有关阿波罗追踪的更多信息,请浏览