Class SqlTemplates
Provides a collection of predefined SQL templates used for various persistence operations within the Umbraco CMS infrastructure layer. This class centralizes SQL statements to promote reuse and maintainability.
Inheritance
object
Namespace: Umbraco.Cms.Infrastructure.Persistence
Assembly: Umbraco.Infrastructure.dll
Syntax
public class SqlTemplates
Constructors
View SourceSqlTemplates(ISqlContext)
Initializes a new instance of the SqlTemplates class with the specified SQL context.
Declaration
public SqlTemplates(ISqlContext sqlContext)
Parameters
| Type | Name | Description |
|---|---|---|
| ISqlContext | sqlContext | The ISqlContext used for SQL template generation. |
Methods
View SourceGet(string, Func<Sql<ISqlContext>, Sql<ISqlContext>>)
Gets a SqlTemplate by key, creating it using the provided SQL builder function if it does not exist.
Declaration
public SqlTemplate Get(string key, Func<Sql<ISqlContext>, Sql<ISqlContext>> sqlBuilder)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key identifying the SQL template. |
| Func<Sql<ISqlContext>, Sql<ISqlContext>> | sqlBuilder | A function that builds the SQL query given a NPoco.Sql<> instance. |
Returns
| Type | Description |
|---|---|
| SqlTemplate | The SqlTemplate associated with the specified key. |