Interface IQueryBuilderFactory
Handles the creation of IQueryBuilder objects.
Namespace: LemonEdge.DataAccess.Core.Abstractions.Factories
Assembly: LemonEdge.DataAccess.Core.Abstractions.dll
Syntax
public interface IQueryBuilderFactory
Methods
CreateDeleteBuilder(string)
Creates a IQueryDeleteBuilder.
This builds DELETE
statements in SQL.
Declaration
IQueryDeleteBuilder CreateDeleteBuilder(string mainTable)
Parameters
Type | Name | Description |
---|---|---|
string | mainTable |
Returns
Type | Description |
---|---|
IQueryDeleteBuilder | A new IQueryDeleteBuilder. |
CreateFunctionBuilder(string)
Creates a IQueryFunctionBuilder.
This builds FUNCTION
statements in SQL.
Declaration
IQueryFunctionBuilder CreateFunctionBuilder(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name. |
Returns
Type | Description |
---|---|
IQueryFunctionBuilder | A new IQueryFunctionBuilder. |
CreateInsertBuilder(string)
Creates a IQueryInsertBuilder.
This builds INSERT
statements in SQL.
Declaration
IQueryInsertBuilder CreateInsertBuilder(string mainTable)
Parameters
Type | Name | Description |
---|---|---|
string | mainTable |
Returns
Type | Description |
---|---|
IQueryInsertBuilder | A new IQueryInsertBuilder. |
CreateOperatorCondition(int, SQLOperator, GroupType, bool, bool, AggregateFunction, string, string, AggregateFunction, string, string, string, bool, string, string, string)
Constructor - use the factory instead. Creates a new OperatorCondition.
Declaration
IOperatorCondition CreateOperatorCondition(int uniqueId, SQLOperator @operator = SQLOperator.LessThan, GroupType groupType = GroupType.And, bool beginGroup = false, bool endGroup = false, AggregateFunction aggregate1 = AggregateFunction.None, string tableAlias1 = null, string column1 = null, AggregateFunction aggregate2 = AggregateFunction.None, string tableAlias2 = null, string column2 = null, string comparativeExpression = null, bool comparativeExpressionIsNull = false, string wholeExpression = null, string nullValue = null, string comment = null)
Parameters
Type | Name | Description |
---|---|---|
int | uniqueId | The unique id. |
SQLOperator | operator | [Optional] The SQLOperator for this condition. |
GroupType | groupType | [Optional] The GroupType for this condition. |
bool | beginGroup | [Optional] Whether this is the starting condition. |
bool | endGroup | [Optional] Whether this is the ending condition. |
AggregateFunction | aggregate1 | [Optional] The aggregate details for table 1. |
string | tableAlias1 | [Optional] The alias details for table 1. |
string | column1 | [Optional] The column for table 1. |
AggregateFunction | aggregate2 | [Optional] The aggregate details for table 2. |
string | tableAlias2 | [Optional] The alias details for table 2. |
string | column2 | [Optional] The column for table 2. |
string | comparativeExpression | [Optional] An expression to be used in the comparison of the condition. Note: sets ComparativeExpressionIsNull |
bool | comparativeExpressionIsNull | Manually set this flag |
string | wholeExpression | [Optional] Any valid SQL to use instead. |
string | nullValue | [Optional] An optional Null value to be provided for TableAlias1.Column1, creating the statement IsNull(TableAlias1.Column1, NullValue) |
string | comment | [Optional] comments to add to the SQL. |
Returns
Type | Description |
---|---|
IOperatorCondition |
CreateProcedureBuilder(string)
Creates a IQueryProcedureBuilder.
This builds PROCEDURE
statements in SQL.
Declaration
IQueryProcedureBuilder CreateProcedureBuilder(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name. |
Returns
Type | Description |
---|---|
IQueryProcedureBuilder | A new IQueryProcedureBuilder. |
CreateSelectBuilder(IQuerySelectBuilder, string, bool)
Creates a IQuerySelectBuilder using the supplied sql select builder as a cte with table to select from.
Declaration
IQuerySelectBuilder CreateSelectBuilder(IQuerySelectBuilder withTable, string withAlias = "", bool withNoLock = false)
Parameters
Type | Name | Description |
---|---|---|
IQuerySelectBuilder | withTable | SqlSelectBuilder holding the cte select statement. |
string | withAlias | Whether to alias this. |
bool | withNoLock | Whether this builder has |
Returns
Type | Description |
---|---|
IQuerySelectBuilder | A new IQuerySelectBuilder. |
CreateSelectBuilder(IQuerySelectBuilder[], string[], bool)
Creates a IQuerySelectBuilder using the supplied sql select builder array as a cte with table to select from.
Declaration
IQuerySelectBuilder CreateSelectBuilder(IQuerySelectBuilder[] withTable, string[] withAliases, bool withNoLock = false)
Parameters
Type | Name | Description |
---|---|---|
IQuerySelectBuilder[] | withTable | SqlSelectBuilder holding the cte select statement. |
string[] | withAliases | Whether to alias this. |
bool | withNoLock | Whether this builder has |
Returns
Type | Description |
---|---|
IQuerySelectBuilder |
CreateSelectBuilder(string, bool)
Creates a IQuerySelectBuilder.
This builds SELECT
statements in SQL.
Declaration
IQuerySelectBuilder CreateSelectBuilder(string mainTable, bool withNoLock = false)
Parameters
Type | Name | Description |
---|---|---|
string | mainTable | The mainTable to select data from will be provided an DatabaseName of t1 |
bool | withNoLock | Whether this builder has |
Returns
Type | Description |
---|---|
IQuerySelectBuilder | A new IQuerySelectBuilder. |
CreateSelectBuilder(string, string, bool)
Creates a IQuerySelectBuilder.
This builds SELECT
statements in SQL.
Declaration
IQuerySelectBuilder CreateSelectBuilder(string mainTable, string uniqueTableAlias, bool withNoLock = false)
Parameters
Type | Name | Description |
---|---|---|
string | mainTable | The mainTable to select data from will be provided an DatabaseName of t1 |
string | uniqueTableAlias | The unique table alias to be used to reference this table |
bool | withNoLock | Whether this builder has |
Returns
Type | Description |
---|---|
IQuerySelectBuilder | A new IQuerySelectBuilder. |
CreateTableBuilder(string, bool, string)
Creates a IQueryTableBuilder.
This builds TABLE
statements in SQL.
Declaration
IQueryTableBuilder CreateTableBuilder(string tableName, bool declareTable = false, string collation = "")
Parameters
Type | Name | Description |
---|---|---|
string | tableName | The name of the table to create |
bool | declareTable | Indicates the SQL generated should include declaring the table to begin with if it is an in-memory @ table. |
string | collation | Indicates all string columns should be created with the supplied collation |
Returns
Type | Description |
---|---|
IQueryTableBuilder | A new IQueryTableBuilder. |
CreateUpdateBuilder(string)
Creates a IQueryUpdateBuilder.
This builds UPDATE
statements in SQL.
Declaration
IQueryUpdateBuilder CreateUpdateBuilder(string mainTable)
Parameters
Type | Name | Description |
---|---|---|
string | mainTable |
Returns
Type | Description |
---|---|
IQueryUpdateBuilder | A new IQueryUpdateBuilder. |
CreateViewBuilder(string)
Creates a IQueryViewBuilder.
This builds VIEW
statements in SQL.
Declaration
IQueryViewBuilder CreateViewBuilder(string viewName)
Parameters
Type | Name | Description |
---|---|---|
string | viewName | The name for the new view |
Returns
Type | Description |
---|---|
IQueryViewBuilder | A new IQueryViewBuilder. |