Table of Contents

Class CteBuilderExtensions

Namespace
LinqToDB
Assembly
linq2db.dll

Extension methods that expose CTE options on ICteBuilder.

public static class CteBuilderExtensions
Inheritance
object
CteBuilderExtensions

Methods

IsMaterialized(ICteBuilder, bool)

Sets the MATERIALIZED / NOT MATERIALIZED CTE hint. Recognized by PostgreSQL 12+, SQLite 3.35+, and ClickHouse 26.3+. Other providers silently drop the hint without tracing — if you rely on the hint for performance, be aware it is a no-op on those providers.

public static ICteBuilder IsMaterialized(this ICteBuilder cteBuilder, bool materialized = true)

Parameters

cteBuilder ICteBuilder

Builder provided by the AsCte callback.

materialized bool

true to emit AS MATERIALIZED, false to emit AS NOT MATERIALIZED.

Returns

ICteBuilder

The same builder for chaining.

Exceptions

ArgumentNullException

cteBuilder is null.

NotSupportedException

cteBuilder does not implement IAnnotatableBuilderInternal. In-box builders always do; custom ICteBuilder implementations must opt in.