Table of Contents

Interface IQueryExecutionSuccessResult

Namespace
NDepend.CodeQuery
Assembly
NDepend.API.dll

Represents a code query successful execution result. Such an object is obtained from a IQueryExecutionResult with Status equals to true.

public interface IQueryExecutionSuccessResult
Extension Methods

Properties (17)

CodeBaseOnWhichQueryHasBeenExecuted

Gets the code base on which the code query has been executed.

ICodeBase CodeBaseOnWhichQueryHasBeenExecuted { get; }

Property Value

ICodeBase

Remarks

If the query has been executed in a comparison context, the returned code base is CompareContextOnWhichQueryHasBeenExecuted.NewerCodeBase.

ColumnsNames

Returns columns' names of the result records.

IReadOnlyList<string> ColumnsNames { get; }

Property Value

IReadOnlyList<string>

Remarks

If IsSingleScalarResult is true, the returned array contains one string "Value".

See Also

CompareContextOnWhichQueryHasBeenExecuted

Gets the ICompareContext object on which the code query has been executed, or null if the query hasen't been executed agains a compare context but only agains a code base.

ICompareContext CompareContextOnWhichQueryHasBeenExecuted { get; }

Property Value

ICompareContext

Remarks

Returns the same object than IQueryCompiledSuccess.CompareContextOnWhichToExecute, or null if this property returns null.

Description

Returns a brief description of the result, such as "12 methods matched" or "Single scalar result : 2 match".

string Description { get; }

Property Value

string

IsARuleViolated

Gets a value indicating whether the code query is a rule and is violated.

bool IsARuleViolated { get; }

Property Value

bool

Remarks

this.KindOfCodeQueryExpression returns KindOfCodeQueryExpression.Rule if this code query is a code rule. Notice that a IQueryExecutionSuccessResult object can be modified when calling a ExtensionMethodsQuery.GetIssues(IRule, IQueryExecutionSuccessResult) overload that takes a suppressedMessage set. In such condition if all issues are suppressed this property can return false although it was returning true before calling GetIssues().

IsSingleScalarResult

Gets a value indicating whether the code query returned a single scalar result.

bool IsSingleScalarResult { get; }

Property Value

bool

Remarks

Only CQLinq queries can return a scalar result through aggregation operators like Count() or Sum().
In such case Records is an empty collection.

KindOfCodeQueryExpression

Gets the kind of code query expression.

KindOfCodeQueryExpression KindOfCodeQueryExpression { get; }

Property Value

KindOfCodeQueryExpression

KindOfMatch

Gets a RecordCellType that indicates which kind of code element is matched.

RecordCellType KindOfMatch { get; }

Property Value

RecordCellType

Remarks

MatchedCodeElements

Gets a collection of code elements matched by the code query. If IsSingleScalarResult is true or if the query is matching issues or rules, gets an empty collection.

IReadOnlyList<ICodeElement> MatchedCodeElements { get; }

Property Value

IReadOnlyList<ICodeElement>

Remarks

This method is a facility to avoid extracting matched code elements from this.Records first column.
This extension method has a O(this.Records.Count) time complexity.
Notice that a IQueryExecutionSuccessResult object can be modified when calling a ExtensionMethodsQuery.GetIssues(IRule, IQueryExecutionSuccessResult) overload that takes a suppressedMessage set. In such condition the list of code-elements returned can be different than the one returned before calling GetIssues().

See Also

MatchedIssues

Gets a collection of IIssue matched by the code query. If IsSingleScalarResult is true or if the query is matching code elements or rules or quality gates, gets an empty collection.

IReadOnlyList<IIssue> MatchedIssues { get; }

Property Value

IReadOnlyList<IIssue>

Remarks

This method is a facility to avoid extracting matched issues from this.Records first column.
This extension method has a O(this.Records.Count) time complexity.

See Also

MatchedQualityGates

Gets a collection of IQualityGate matched by the code query. If IsSingleScalarResult is true or if the query is matching code elements or issues or rules, gets an empty collection.

IReadOnlyList<IQualityGate> MatchedQualityGates { get; }

Property Value

IReadOnlyList<IQualityGate>

Remarks

This method is a facility to avoid extracting matched quality gates from this.Records first column.
This extension method has a O(this.Records.Count) time complexity.

See Also

MatchedRules

Gets a collection of IRule matched by the code query. If IsSingleScalarResult is true or if the query is matching code elements or issues or quality gates, gets an empty collection.

IReadOnlyList<IRule> MatchedRules { get; }

Property Value

IReadOnlyList<IRule>

Remarks

This method is a facility to avoid extracting matched rules from this.Records first column.
This extension method has a O(this.Records.Count) time complexity.

See Also

OriginalQueryString

Gets the original code query string.

string OriginalQueryString { get; }

Property Value

string

QualityGateStatus

If this code query is a Quality Gate gets the status, else returns QualityGateStatus.Pass.

QualityGateStatus QualityGateStatus { get; }

Property Value

QualityGateStatus

Remarks

this.KindOfCodeQueryExpression returns KindOfCodeQueryExpression.QualityGate if this code query is a quality gate.

Records

Gets records result.

IReadOnlyList<RecordBase> Records { get; }

Property Value

IReadOnlyList<RecordBase>

Remarks

If IsSingleScalarResult is true, the collection returned is empty.
Notice that a IQueryExecutionSuccessResult object can be modified when calling a ExtensionMethodsQuery.GetIssues(IRule, IQueryExecutionSuccessResult) overload that takes a suppressedMessage set. In such condition the list of records returned can be different than the one returned before calling GetIssues().

See Also

SingleScalarValue

Gets the single scalar result returned by the query.

double? SingleScalarValue { get; }

Property Value

double?

Remarks

Only CQLinq queries can return a scalar result through aggregation operators like Count() or Sum().
If IsSingleScalarResult is false, this property returns null.
If IsSingleScalarResult is true, this property might returns null if the CQLinq aggregation operation returned null.

See Also

TargetCodeElements

Gets code elements referenced in the query itself, like the code element named "XYZ" in "from t in Types where t.IsUsing("XYZ") select t".

IReadOnlyList<ICodeElement> TargetCodeElements { get; }

Property Value

IReadOnlyList<ICodeElement>

Remarks