Table of Contents

Class QueryGuardQueryTag

Namespace
QueryGuard
Assembly
QueryGuard.Core.dll

Recognizes QueryGuard directives that travel with a query as an EF Core tag.

public static class QueryGuardQueryTag
Inheritance
QueryGuardQueryTag
Inherited Members

Examples

var items = await db.Items
    .TagWith("QueryGuard:Ignore reason=bounded-reference-lookup")
    .ToListAsync();

Remarks

EF Core's TagWith emits its argument as a leading SQL comment. That makes it the one place a developer can attach an instruction to a specific LINQ query, right where the query is written, rather than in a configuration file that drifts away from it.

Only the recognized QueryGuard: prefix is retained. An arbitrary tag is a comment like any other and is stripped during normalization: QueryGuard does not keep text it was not asked to interpret.

Fields

IgnoreDirective

The directive that marks a query's repetition as intentional.

Prefix

The prefix that marks a comment as a QueryGuard directive.

Methods

Extract(string?)

Extracts every QueryGuard directive from a command's leading comments.

GetIgnoreReason(IReadOnlyList<string>?)

Reads the reason a query's repetition was declared intentional.

HasIgnoreDirective(IReadOnlyList<string>?)

Determines whether a set of tags asks QueryGuard to treat the query's repetition as intentional.