Exemplo n.º 1
0
        /// <inheritdoc />
        public virtual void QueryPlanCached(string queryHash, IGraphQueryPlan queryPlan)
        {
            if (!this.IsEnabled(LogLevel.Debug))
            {
                return;
            }

            var entry = new QueryPlanCacheAddLogEntry(queryHash, queryPlan);

            this.LogEvent(LogLevel.Debug, entry);
        }
Exemplo n.º 2
0
        public async Task QueryPlanCacheAddLogEntry()
        {
            var server = new TestServerBuilder()
                         .AddGraphType <LogTestController>()
                         .Build();
            var queryPlan = await server.CreateQueryPlan("query Operation1{ field1 } query Operation2 { fieldException }");

            var entry = new QueryPlanCacheAddLogEntry("abc123", queryPlan);

            Assert.AreEqual(LogEventIds.QueryCacheAdd.Id, entry.EventId);
            Assert.AreEqual("abc123", entry.QueryPlanHashCode);
            Assert.AreEqual(typeof(GraphSchema).FriendlyName(true), entry.SchemaTypeName);
            Assert.AreEqual(queryPlan.Id, entry.QueryPlanId);
            Assert.IsNotNull(entry.ToString());
        }