Class QueryBuilder
An abstract class for building T-SQL statements from table and columns definitions.
Namespace: Cuemon.Data
Assembly: Cuemon.Data.dll
Syntax
public abstract class QueryBuilder
Constructors
| Improve this DocQueryBuilder()
Initializes a new instance of the QueryBuilder class.
Declaration
protected QueryBuilder()
QueryBuilder(String, IDictionary<String, String>)
Initializes a new instance of the QueryBuilder class.
Declaration
protected QueryBuilder(string tableName, IDictionary<string, string> keyColumns)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | The name of the table or view. |
System.Collections.Generic.IDictionary<System.String, System.String> | keyColumns | The key columns to be used in this QueryBuilder instance. |
QueryBuilder(String, IDictionary<String, String>, IDictionary<String, String>)
Initializes a new instance of the QueryBuilder class.
Declaration
protected QueryBuilder(string tableName, IDictionary<string, string> keyColumns, IDictionary<string, string> columns)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | The name of the table or view. |
System.Collections.Generic.IDictionary<System.String, System.String> | keyColumns | The key columns to be used in this QueryBuilder instance. |
System.Collections.Generic.IDictionary<System.String, System.String> | columns | The none-key columns to be used in this QueryBuilder instance. |
Properties
| Improve this DocColumns
Gets the none-key columns to be used in the QueryBuilder instance.
Declaration
public IDictionary<string, string> Columns { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.String> | The none-key columns to be used in the QueryBuilder instance. |
EnableDirtyReads
Gets or sets a value indicating whether the data source should try to prevent locking from readonly queries.
Declaration
public bool EnableDirtyReads { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
EnableReadLimit
Gets or sets a value indicating whether a query is restricted in how many records (ReadLimit) can be retrieved from a repository. Default is false.
Declaration
public bool EnableReadLimit { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
EnableTableAndColumnEncapsulation
Gets or sets a value indicating whether an encapsulation should be committed automatically on table and column names.
Declaration
public bool EnableTableAndColumnEncapsulation { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
KeyColumns
Gets the key columns to be used in the QueryBuilder instance.
Declaration
public IDictionary<string, string> KeyColumns { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.String> | The key columns to be used in the QueryBuilder instance. |
ReadLimit
Gets or sets a value limiting the maximum amount of records that can be retreived from a repository. Default is 1000.
Declaration
public int ReadLimit { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The maximum amount of records that can be retreived from a repository. |
TableName
Gets or sets the name of the table or view.
Declaration
public string TableName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name of the table or view. |
Methods
| Improve this DocAppend(String)
Appends the specified query fragment to the end of this instance.
Declaration
protected void Append(string queryFragment)
Parameters
Type | Name | Description |
---|---|---|
System.String | queryFragment | The query fragment to append. |
Append(String, Object[])
Appends a formatted query fragment, which contains zero or more format specifications, to the end of this instance. Each format specification is replaced by the string representation of a corresponding object argument.
Declaration
protected void Append(string queryFragment, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.String | queryFragment | The query fragment to append. |
System.Object[] | args | An array of objects to format. |
GetQuery(QueryType)
Create and returns the builded query from the specified QueryType.
Declaration
public string GetQuery(QueryType queryType)
Parameters
Type | Name | Description |
---|---|---|
QueryType | queryType | Type of the query to create. |
Returns
Type | Description |
---|---|
System.String | The builded T-SQL query. |
GetQuery(QueryType, String)
Create and returns the builded query from the specified QueryType.
Declaration
public abstract string GetQuery(QueryType queryType, string tableName)
Parameters
Type | Name | Description |
---|---|---|
QueryType | queryType | Type of the query to create. |
System.String | tableName | The name of the table or view. Overrides the class wide tableName. |
Returns
Type | Description |
---|---|
System.String |
ToString()
Returns a System.String that represents the current System.Object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String that represents the current System.Object. |