Class LinqExtensions
Contains extension methods for LINQ queries.
Inheritance
Namespace: LinqToDB
Assembly: linq2db.dll
Syntax
public static class LinqExtensions : object
Properties
| Improve this Doc View SourceExtensionsAdapter
Declaration
public static IExtensionsAdapter ExtensionsAdapter { get; set; }
Property Value
Type | Description |
---|---|
IExtensionsAdapter |
ProcessSourceQueryable
Gets or sets callback for preprocessing query before execution. Useful for intercepting queries.
Declaration
public static Func<IQueryable, IQueryable>? ProcessSourceQueryable { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<Func<IQueryable, IQueryable>> |
Methods
| Improve this Doc View SourceAsCte<TSource>(IQueryable<TSource>)
Specifies a temporary named result set, known as a common table expression (CTE).
Declaration
public static IQueryable<TSource> AsCte<TSource>(this IQueryable<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Common table expression. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
AsCte<TSource>(IQueryable<TSource>, Nullable<String>)
Specifies a temporary named result set, known as a common table expression (CTE).
Declaration
public static IQueryable<TSource> AsCte<TSource>(this IQueryable<TSource> source, string? name)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query. |
System.Nullable<System.String> | name | Common table expression name. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Common table expression. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
AsQueryable<TElement>(IEnumerable<TElement>, IDataContext)
Converts a generic
Declaration
public static IQueryable<TElement> AsQueryable<TElement>(this IEnumerable<TElement> source, IDataContext dataContext)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TElement> | source | A sequence to convert. |
IDataContext | dataContext | Database connection context. |
Returns
Type | Description |
---|---|
IQueryable<TElement> | An |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements of |
AsSubQuery<TSource>(IQueryable<TSource>)
Defines that sub-query is mandatory for source
query and cannot be removed during the query optimization.
Declaration
public static IQueryable<TSource> AsSubQuery<TSource>(this IQueryable<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query converted into sub-query. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
AsSubQuery<TSource>(IQueryable<TSource>, String)
Defines that sub-query is mandatory for source
query and cannot be removed during the query optimization.
Declaration
public static IQueryable<TSource> AsSubQuery<TSource>(this IQueryable<TSource> source, string queryName)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
System.String | queryName | Query name. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query converted into sub-query. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
AsSubQuery<TKey, TElement>(IQueryable<IGrouping<TKey, TElement>>)
Defines that sub-query is mandatory for grouping
query and cannot be removed during the query optimization.
Declaration
public static IQueryable<TKey> AsSubQuery<TKey, TElement>(this IQueryable<IGrouping<TKey, TElement>> grouping)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<IGrouping<TKey, TElement>> | grouping | Source data query. |
Returns
Type | Description |
---|---|
IQueryable<TKey> | Query converted into sub-query. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the key of the |
TElement | The type of the values in the |
AsSubQuery<TKey, TElement>(IQueryable<IGrouping<TKey, TElement>>, String)
Defines that sub-query is mandatory for grouping
query and cannot be removed during the query optimization.
Declaration
public static IQueryable<TKey> AsSubQuery<TKey, TElement>(this IQueryable<IGrouping<TKey, TElement>> grouping, string queryName)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<IGrouping<TKey, TElement>> | grouping | Source data query. |
System.String | queryName | Query name. |
Returns
Type | Description |
---|---|
IQueryable<TKey> | Query converted into sub-query. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the key of the |
TElement | The type of the values in the |
AsUpdatable<T>(IQueryable<T>)
Casts
Declaration
public static IUpdatable<T> AsUpdatable<T>(this IQueryable<T> source)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source |
Returns
Type | Description |
---|---|
IUpdatable<T> | IUpdatable<T> query. |
Type Parameters
Name | Description |
---|---|
T | Query record type. |
AsValueInsertable<T>(ITable<T>)
Starts insert operation LINQ query definition.
Declaration
public static IValueInsertable<T> AsValueInsertable<T>(this ITable<T> source)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | source | Target table. |
Returns
Type | Description |
---|---|
IValueInsertable<T> | Insertable source query. |
Type Parameters
Name | Description |
---|---|
T | Target table mapping class. |
CrossJoin<TOuter, TInner, TResult>(IQueryable<TOuter>, IQueryable<TInner>, Expression<Func<TOuter, TInner, TResult>>)
Defines cross join between two sub-queries or tables.
Declaration
public static IQueryable<TResult> CrossJoin<TOuter, TInner, TResult>(this IQueryable<TOuter> outer, IQueryable<TInner> inner, Expression<Func<TOuter, TInner, TResult>> resultSelector)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TOuter> | outer | Left join operand. |
IQueryable<TInner> | inner | Right join operand. |
Expression<Func<TOuter, TInner, TResult>> | resultSelector | A function to create a result element from two matching elements. |
Returns
Type | Description |
---|---|
IQueryable<TResult> | Right operand. |
Type Parameters
Name | Description |
---|---|
TOuter | Type of record for left join operand. |
TInner | Type of record for right join operand. |
TResult | The type of the result elements. |
DatabaseName<T>(ITable<T>, Nullable<String>)
Overrides database name with new name for current query. This call will have effect only for databases that support database name in fully-qualified table name.
Supported by: Access, DB2, MySQL, PostgreSQL, SAP HANA, SQLite, Informix, SQL Server, Sybase ASE.
Requires schema name (see
PostgreSQL supports only name of current database.
Declaration
public static ITable<T> DatabaseName<T>(this ITable<T> table, string? name)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | table | Table-like query source. |
System.Nullable<System.String> | name | Name of database. |
Returns
Type | Description |
---|---|
ITable<T> | Table-like query source with new database name. |
Type Parameters
Name | Description |
---|---|
T | Table record mapping class. |
Delete<T>(IQueryable<T>)
Executes delete operation, using source query as filter for records, that should be deleted.
Declaration
public static int Delete<T>(this IQueryable<T> source)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Query that returns records to delete. |
Returns
Type | Description |
---|---|
System.Int32 | Number of deleted records. |
Type Parameters
Name | Description |
---|---|
T | Mapping class for delete operation target table. |
Delete<T>(IQueryable<T>, Expression<Func<T, Boolean>>)
Executes delete operation, using source query as initial filter for records, that should be deleted, and predicate expression as additional filter.
Declaration
public static int Delete<T>(this IQueryable<T> source, Expression<Func<T, bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Query that returns records to delete. |
Expression<Func<T, System.Boolean>> | predicate | Filter expression, to specify what records from source should be deleted. |
Returns
Type | Description |
---|---|
System.Int32 | Number of deleted records. |
Type Parameters
Name | Description |
---|---|
T | Mapping class for delete operation target table. |
DeleteAsync<T>(IQueryable<T>, CancellationToken)
Executes delete operation asynchronously, using source query as filter for records, that should be deleted.
Declaration
public static async Task<int> DeleteAsync<T>(this IQueryable<T> source, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Query that returns records to delete. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of deleted records. |
Type Parameters
Name | Description |
---|---|
T | Mapping class for delete operation target table. |
DeleteAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken)
Executes delete operation asynchronously, using source query as initial filter for records, that should be deleted, and predicate expression as additional filter.
Declaration
public static async Task<int> DeleteAsync<T>(this IQueryable<T> source, Expression<Func<T, bool>> predicate, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Query that returns records to delete. |
Expression<Func<T, System.Boolean>> | predicate | Filter expression, to specify what records from source should be deleted. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of deleted records. |
Type Parameters
Name | Description |
---|---|
T | Mapping class for delete operation target table. |
DeleteWhenMatched<TTarget, TSource>(IMergeableSource<TTarget, TSource>)
Adds new delete operation to merge and returns new merge command with added operation. This operation removes record in target table for each record that was matched in source and target, if it wasn't processed by previous operations.
Declaration
public static IMergeable<TTarget, TSource> DeleteWhenMatched<TTarget, TSource>(this IMergeableSource<TTarget, TSource> merge)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TSource> | merge | Merge command builder interface. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TSource> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
DeleteWhenMatchedAnd<TTarget, TSource>(IMergeableSource<TTarget, TSource>, Expression<Func<TTarget, TSource, Boolean>>)
Adds new delete operation to merge and returns new merge command with added operation. This operation removes record in target table for each record that was matched in source and target, if it was matched by operation predicate and wasn't processed by previous operations.
Declaration
public static IMergeable<TTarget, TSource> DeleteWhenMatchedAnd<TTarget, TSource>(this IMergeableSource<TTarget, TSource> merge, Expression<Func<TTarget, TSource, bool>> searchCondition)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TSource> | merge | Merge command builder interface. |
Expression<Func<TTarget, TSource, System.Boolean>> | searchCondition | Operation execution condition over target and source records. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TSource> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
DeleteWhenNotMatchedBySource<TTarget, TSource>(IMergeableSource<TTarget, TSource>)
IMPORTANT: This operation supported only by Microsoft SQL Server. Adds new delete by source operation to merge and returns new merge command with added operation. This operation removes record in target table for each record that was matched only in target and wasn't processed by previous operations.
Declaration
public static IMergeable<TTarget, TSource> DeleteWhenNotMatchedBySource<TTarget, TSource>(this IMergeableSource<TTarget, TSource> merge)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TSource> | merge | Merge command builder interface. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TSource> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
DeleteWhenNotMatchedBySourceAnd<TTarget, TSource>(IMergeableSource<TTarget, TSource>, Expression<Func<TTarget, Boolean>>)
IMPORTANT: This operation supported only by Microsoft SQL Server. Adds new delete by source operation to merge and returns new merge command with added operation. This operation removes record in target table for each record that was matched only in target and passed filtering with operation predicate, if it wasn't processed by previous operations.
Declaration
public static IMergeable<TTarget, TSource> DeleteWhenNotMatchedBySourceAnd<TTarget, TSource>(this IMergeableSource<TTarget, TSource> merge, Expression<Func<TTarget, bool>> searchCondition)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TSource> | merge | Merge command builder interface. |
Expression<Func<TTarget, System.Boolean>> | searchCondition | Operation execution condition over target record. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TSource> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
DeleteWithOutput<TSource>(IQueryable<TSource>)
Deletes records from source query and returns deleted records.
Declaration
public static IEnumerable<TSource> DeleteWithOutput<TSource>(this IQueryable<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for delete operation. |
Returns
Type | Description |
---|---|
IEnumerable<TSource> | Enumeration of records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
Remarks
Database support:
DeleteWithOutput<TSource, TOutput>(IQueryable<TSource>, Expression<Func<TSource, TOutput>>)
Deletes records from source query into target table and returns deleted records.
Declaration
public static IEnumerable<TOutput> DeleteWithOutput<TSource, TOutput>(this IQueryable<TSource> source, Expression<Func<TSource, TOutput>> outputExpression)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for delete operation. |
Expression<Func<TSource, TOutput>> | outputExpression | Output record constructor expression. Expression supports only record new expression with field initializers. |
Returns
Type | Description |
---|---|
IEnumerable<TOutput> | Enumeration of records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TOutput | Output table record type. |
Remarks
Database support:
DeleteWithOutputAsync<TSource>(IQueryable<TSource>, CancellationToken)
Deletes records from source query into target table asynchronously and returns deleted records.
Declaration
public static Task<TSource[]> DeleteWithOutputAsync<TSource>(this IQueryable<TSource> source, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for delete operation. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<TSource[]> | Array of records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
Remarks
Database support:
DeleteWithOutputAsync<TSource, TOutput>(IQueryable<TSource>, Expression<Func<TSource, TOutput>>, CancellationToken)
Deletes records from source query into target table asynchronously and returns deleted records.
Declaration
public static Task<TOutput[]> DeleteWithOutputAsync<TSource, TOutput>(this IQueryable<TSource> source, Expression<Func<TSource, TOutput>> outputExpression, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for delete operation. |
Expression<Func<TSource, TOutput>> | outputExpression | Output record constructor expression. Expression supports only record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<TOutput[]> | Array of records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TOutput | Output table record type. |
Remarks
Database support:
DeleteWithOutputInto<TSource, TOutput>(IQueryable<TSource>, ITable<TOutput>)
Deletes records from source query into target table and outputs deleted records into outputTable
.
Declaration
public static int DeleteWithOutputInto<TSource, TOutput>(this IQueryable<TSource> source, ITable<TOutput> outputTable)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for delete operation. |
ITable<TOutput> | outputTable | Output table. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TOutput | Output table record type. |
Remarks
Database support:
DeleteWithOutputInto<TSource, TOutput>(IQueryable<TSource>, ITable<TOutput>, Expression<Func<TSource, TOutput>>)
Deletes records from source query into target table and outputs deleted records into outputTable
.
Declaration
public static int DeleteWithOutputInto<TSource, TOutput>(this IQueryable<TSource> source, ITable<TOutput> outputTable, Expression<Func<TSource, TOutput>> outputExpression)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for delete operation. |
ITable<TOutput> | outputTable | Output table. |
Expression<Func<TSource, TOutput>> | outputExpression | Output record constructor expression. Expression supports only record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TOutput | Output table record type. |
Remarks
Database support:
DeleteWithOutputIntoAsync<TSource, TOutput>(IQueryable<TSource>, ITable<TOutput>, CancellationToken)
Deletes records from source query into target table asynchronously and outputs deleted records into outputTable
.
Declaration
public static Task<int> DeleteWithOutputIntoAsync<TSource, TOutput>(this IQueryable<TSource> source, ITable<TOutput> outputTable, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for delete operation. |
ITable<TOutput> | outputTable | Output table. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TOutput | Output table record type. |
Remarks
Database support:
DeleteWithOutputIntoAsync<TSource, TOutput>(IQueryable<TSource>, ITable<TOutput>, Expression<Func<TSource, TOutput>>, CancellationToken)
Deletes records from source query into target table asynchronously and outputs deleted records into outputTable
.
Declaration
public static Task<int> DeleteWithOutputIntoAsync<TSource, TOutput>(this IQueryable<TSource> source, ITable<TOutput> outputTable, Expression<Func<TSource, TOutput>> outputExpression, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for delete operation. |
ITable<TOutput> | outputTable | Output table. |
Expression<Func<TSource, TOutput>> | outputExpression | Output record constructor expression. Expression supports only record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TOutput | Output table record type. |
Remarks
Database support:
DisableGuard<TKey, TElement>(IQueryable<IGrouping<TKey, TElement>>)
Disables grouping guard for particular grouping
query.
Declaration
public static IQueryable<IGrouping<TKey, TElement>> DisableGuard<TKey, TElement>(this IQueryable<IGrouping<TKey, TElement>> grouping)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<IGrouping<TKey, TElement>> | grouping | Source data query. |
Returns
Type | Description |
---|---|
IQueryable<IGrouping<TKey, TElement>> | Query with suppressed grouping guard. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the key of the |
TElement | The type of the values in the |
Drop<T>(ITable<T>, Boolean)
Drops database table.
Declaration
public static int Drop<T>(this ITable<T> target, bool throwExceptionIfNotExists = true)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Dropped table. |
System.Boolean | throwExceptionIfNotExists | If |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. Usually |
Type Parameters
Name | Description |
---|---|
T | Table record type. |
DropAsync<T>(ITable<T>, Boolean, CancellationToken)
Drops database table asynchronously.
Declaration
public static async Task<int> DropAsync<T>(this ITable<T> target, bool throwExceptionIfNotExists = true, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Dropped table. |
System.Boolean | throwExceptionIfNotExists | If |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. Usually |
Type Parameters
Name | Description |
---|---|
T | Table record type. |
ElementAt<TSource>(IQueryable<TSource>, Expression<Func<Int32>>)
Selects record at specified position from source query.
If query doesn't return enough records,
Declaration
public static TSource ElementAt<TSource>(this IQueryable<TSource> source, Expression<Func<int>> index)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query. |
Expression<Func<System.Int32>> | index | Expression that defines index of record to select. |
Returns
Type | Description |
---|---|
TSource | Record at specified position. |
Type Parameters
Name | Description |
---|---|
TSource | Source table record type. |
ElementAtAsync<TSource>(IQueryable<TSource>, Expression<Func<Int32>>, CancellationToken)
Selects record at specified position from source query asynchronously.
If query doesn't return enough records,
Declaration
public static async Task<TSource> ElementAtAsync<TSource>(this IQueryable<TSource> source, Expression<Func<int>> index, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query. |
Expression<Func<System.Int32>> | index | Expression that defines index of record to select. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<TSource> | Record at specified position. |
Type Parameters
Name | Description |
---|---|
TSource | Source table record type. |
ElementAtOrDefault<TSource>(IQueryable<TSource>, Expression<Func<Int32>>)
Selects record at specified position from source query.
Declaration
public static TSource ElementAtOrDefault<TSource>(this IQueryable<TSource> source, Expression<Func<int>> index)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query. |
Expression<Func<System.Int32>> | index | Expression that defines index of record to select. |
Returns
Type | Description |
---|---|
TSource | Record at specified position or default value, if source query doesn't have record with such index. |
Type Parameters
Name | Description |
---|---|
TSource | Source table record type. |
ElementAtOrDefaultAsync<TSource>(IQueryable<TSource>, Expression<Func<Int32>>, CancellationToken)
Selects record at specified position from source query asynchronously.
Declaration
public static async Task<TSource> ElementAtOrDefaultAsync<TSource>(this IQueryable<TSource> source, Expression<Func<int>> index, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query. |
Expression<Func<System.Int32>> | index | Expression that defines index of record to select. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<TSource> | Record at specified position or default value, if source query doesn't have record with such index. |
Type Parameters
Name | Description |
---|---|
TSource | Source table record type. |
ExceptAll<TSource>(IQueryable<TSource>, IEnumerable<TSource>)
Produces the set difference of two sequences.
Declaration
public static IQueryable<TSource> ExceptAll<TSource>(this IQueryable<TSource> source1, IEnumerable<TSource> source2)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source1 | An |
IEnumerable<TSource> | source2 | An |
Returns
Type | Description |
---|---|
IQueryable<TSource> | An |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the input sequences. |
FullJoin<TSource>(IQueryable<TSource>, Expression<Func<TSource, Boolean>>)
Defines full outer join between two sub-queries or tables.
Declaration
public static IQueryable<TSource> FullJoin<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Right join operand. |
Expression<Func<TSource, System.Boolean>> | predicate | Join predicate. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Right operand. |
Type Parameters
Name | Description |
---|---|
TSource | Type of record for right join operand. |
FullJoin<TOuter, TInner, TResult>(IQueryable<TOuter>, IQueryable<TInner>, Expression<Func<TOuter, TInner, Boolean>>, Expression<Func<TOuter, TInner, TResult>>)
Defines full outer join between two sub-queries or tables.
Declaration
public static IQueryable<TResult> FullJoin<TOuter, TInner, TResult>(this IQueryable<TOuter> outer, IQueryable<TInner> inner, Expression<Func<TOuter, TInner, bool>> predicate, Expression<Func<TOuter, TInner, TResult>> resultSelector)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TOuter> | outer | Left join operand. |
IQueryable<TInner> | inner | Right join operand. |
Expression<Func<TOuter, TInner, System.Boolean>> | predicate | Join predicate. |
Expression<Func<TOuter, TInner, TResult>> | resultSelector | A function to create a result element from two matching elements. |
Returns
Type | Description |
---|---|
IQueryable<TResult> | Right operand. |
Type Parameters
Name | Description |
---|---|
TOuter | Type of record for left join operand. |
TInner | Type of record for right join operand. |
TResult | The type of the result elements. |
GenerateTestString(IQueryable, Boolean)
Generates test source code for specified query. This method could be usefull to debug queries and attach test code to linq2db issue reports.
Declaration
public static string GenerateTestString(this IQueryable query, bool mangleNames = false)
Parameters
Type | Name | Description |
---|---|---|
IQueryable | query | Query to test. |
System.Boolean | mangleNames | Should we use real names for used types, members and namespace or generate obfuscated names. |
Returns
Type | Description |
---|---|
System.String | Test source code. |
HasCreateIfNotExists(TableOptions)
Declaration
public static bool HasCreateIfNotExists(this TableOptions tableOptions)
Parameters
Type | Name | Description |
---|---|---|
TableOptions | tableOptions |
Returns
Type | Description |
---|---|
System.Boolean |
HasDropIfExists(TableOptions)
Declaration
public static bool HasDropIfExists(this TableOptions tableOptions)
Parameters
Type | Name | Description |
---|---|---|
TableOptions | tableOptions |
Returns
Type | Description |
---|---|
System.Boolean |
HasIsGlobalTemporaryData(TableOptions)
Declaration
public static bool HasIsGlobalTemporaryData(this TableOptions tableOptions)
Parameters
Type | Name | Description |
---|---|---|
TableOptions | tableOptions |
Returns
Type | Description |
---|---|
System.Boolean |
HasIsGlobalTemporaryStructure(TableOptions)
Declaration
public static bool HasIsGlobalTemporaryStructure(this TableOptions tableOptions)
Parameters
Type | Name | Description |
---|---|---|
TableOptions | tableOptions |
Returns
Type | Description |
---|---|
System.Boolean |
HasIsLocalTemporaryData(TableOptions)
Declaration
public static bool HasIsLocalTemporaryData(this TableOptions tableOptions)
Parameters
Type | Name | Description |
---|---|---|
TableOptions | tableOptions |
Returns
Type | Description |
---|---|
System.Boolean |
HasIsLocalTemporaryStructure(TableOptions)
Declaration
public static bool HasIsLocalTemporaryStructure(this TableOptions tableOptions)
Parameters
Type | Name | Description |
---|---|---|
TableOptions | tableOptions |
Returns
Type | Description |
---|---|
System.Boolean |
HasIsTemporary(TableOptions)
Declaration
public static bool HasIsTemporary(this TableOptions tableOptions)
Parameters
Type | Name | Description |
---|---|---|
TableOptions | tableOptions |
Returns
Type | Description |
---|---|
System.Boolean |
HasIsTransactionTemporaryData(TableOptions)
Declaration
public static bool HasIsTransactionTemporaryData(this TableOptions tableOptions)
Parameters
Type | Name | Description |
---|---|---|
TableOptions | tableOptions |
Returns
Type | Description |
---|---|
System.Boolean |
HasUniqueKey<TSource, TKey>(IQueryable<TSource>, Expression<Func<TSource, TKey>>)
Records unique key for IQueryable. It allows sub-query to be optimized out in LEFT JOIN if columns from sub-query are not used in final projection and predicate.
Declaration
public static IQueryable<TSource> HasUniqueKey<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
Expression<Func<TSource, TKey>> | keySelector | A function to specify which fields are unique. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query converted into sub-query. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TKey | Key type. |
Having<TSource>(IQueryable<TSource>, Expression<Func<TSource, Boolean>>)
Filters source query using HAVING SQL clause.
In general you don't need to use this method as linq2db is able to propely identify current context for
Declaration
public static IQueryable<TSource> Having<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query to filter. |
Expression<Func<TSource, System.Boolean>> | predicate | Filtering expression. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Filtered query. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
IgnoreFilters<TSource>(IQueryable<TSource>, Type[])
Disables Query Filters in current query.
Declaration
public static IQueryable<TSource> IgnoreFilters<TSource>(this IQueryable<TSource> source, params Type[] entityTypes)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query. |
Type[] | entityTypes | Optional types with which filters should be disabled. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query with disabled filters. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
IndexHint<TSource>(ITable<TSource>, String)
Adds an index hint to a table in generated query.
Declaration
public static ITable<TSource> IndexHint<TSource>(this ITable<TSource> table, string hint)
Parameters
Type | Name | Description |
---|---|---|
ITable<TSource> | table | Table-like query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
Returns
Type | Description |
---|---|
ITable<TSource> | Table-like query source with index hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
IndexHint<TSource, TParam>(ITable<TSource>, String, TParam)
Adds an index hint to a table in generated query.
Declaration
public static ITable<TSource> IndexHint<TSource, TParam>(this ITable<TSource> table, string hint, TParam hintParameter)
Parameters
Type | Name | Description |
---|---|---|
ITable<TSource> | table | Table-like query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
TParam | hintParameter | Table hint parameter. |
Returns
Type | Description |
---|---|
ITable<TSource> | Table-like query source with index hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
TParam | Table hint parameter type. |
IndexHint<TSource, TParam>(ITable<TSource>, String, TParam[])
Adds an index hint to a table in generated query.
Declaration
public static ITable<TSource> IndexHint<TSource, TParam>(this ITable<TSource> table, string hint, params TParam[] hintParameters)
Parameters
Type | Name | Description |
---|---|---|
ITable<TSource> | table | Table-like query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
TParam[] | hintParameters | Table hint parameters. |
Returns
Type | Description |
---|---|
ITable<TSource> | Table-like query source with index hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
TParam | Table hint parameter type. |
InlineParameters<TSource>(IQueryable<TSource>)
Inline parameters in query which can be converted to SQL Literal.
Declaration
public static IQueryable<TSource> InlineParameters<TSource>(this IQueryable<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query with inlined parameters. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
InnerJoin<TSource>(IQueryable<TSource>, Expression<Func<TSource, Boolean>>)
Defines inner join between two sub-queries or tables.
Declaration
public static IQueryable<TSource> InnerJoin<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Right join operand. |
Expression<Func<TSource, System.Boolean>> | predicate | Join predicate. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Right operand. |
Type Parameters
Name | Description |
---|---|
TSource | Type of record for right join operand. |
InnerJoin<TOuter, TInner, TResult>(IQueryable<TOuter>, IQueryable<TInner>, Expression<Func<TOuter, TInner, Boolean>>, Expression<Func<TOuter, TInner, TResult>>)
Defines inner or outer join between two sub-queries or tables.
Declaration
public static IQueryable<TResult> InnerJoin<TOuter, TInner, TResult>(this IQueryable<TOuter> outer, IQueryable<TInner> inner, Expression<Func<TOuter, TInner, bool>> predicate, Expression<Func<TOuter, TInner, TResult>> resultSelector)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TOuter> | outer | Left join operand. |
IQueryable<TInner> | inner | Right join operand. |
Expression<Func<TOuter, TInner, System.Boolean>> | predicate | Join predicate. |
Expression<Func<TOuter, TInner, TResult>> | resultSelector | A function to create a result element from two matching elements. |
Returns
Type | Description |
---|---|
IQueryable<TResult> | Right operand. |
Type Parameters
Name | Description |
---|---|
TOuter | Type of record for left join operand. |
TInner | Type of record for right join operand. |
TResult | The type of the result elements. |
Insert<T>(ITable<T>, Expression<Func<T>>)
Inserts single record into target table.
Declaration
public static int Insert<T>(this ITable<T> target, Expression<Func<T>> setter)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Target table. |
Expression<Func<T>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. |
Type Parameters
Name | Description |
---|---|
T | Inserted record type. |
Insert<T>(IValueInsertable<T>)
Executes insert query.
Declaration
public static int Insert<T>(this IValueInsertable<T> source)
Parameters
Type | Name | Description |
---|---|---|
IValueInsertable<T> | source | Insert query. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. |
Type Parameters
Name | Description |
---|---|
T | Target table record type. |
Insert<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>)
Inserts records from source query into target table.
Declaration
public static int Insert<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type |
Insert<TSource, TTarget>(ISelectInsertable<TSource, TTarget>)
Executes configured insert query.
Declaration
public static int Insert<TSource, TTarget>(this ISelectInsertable<TSource, TTarget> source)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
InsertAsync<T>(ITable<T>, Expression<Func<T>>, CancellationToken)
Inserts single record into target table asynchronously.
Declaration
public static async Task<int> InsertAsync<T>(this ITable<T> target, Expression<Func<T>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Target table. |
Expression<Func<T>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
T | Inserted record type. |
InsertAsync<T>(IValueInsertable<T>, CancellationToken)
Executes insert query asynchronously.
Declaration
public static async Task<int> InsertAsync<T>(this IValueInsertable<T> source, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IValueInsertable<T> | source | Insert query. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
T | Target table record type. |
InsertAsync<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, CancellationToken)
Inserts records from source query into target table asynchronously.
Declaration
public static async Task<int> InsertAsync<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type |
InsertAsync<TSource, TTarget>(ISelectInsertable<TSource, TTarget>, CancellationToken)
Executes configured insert query asynchronously.
Declaration
public static async Task<int> InsertAsync<TSource, TTarget>(this ISelectInsertable<TSource, TTarget> source, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
InsertOrUpdate<T>(ITable<T>, Expression<Func<T>>, Nullable<Expression<Func<T, T>>>)
Inserts new record into target table or updates existing record if record with the same primary key value already exists in target table.
When null
value or expression without field setters passed to onDuplicateKeyUpdateSetter
, this method
implements INSERT IF NOT EXISTS
logic.
Declaration
public static int InsertOrUpdate<T>(this ITable<T> target, Expression<Func<T>> insertSetter, Expression<Func<T, T>>? onDuplicateKeyUpdateSetter)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Target table. |
Expression<Func<T>> | insertSetter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
System.Nullable<Expression<Func<T, T>>> | onDuplicateKeyUpdateSetter | Updated record constructor expression. Expression supports only target table record new expression with field initializers. Accepts updated record as parameter. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. |
Type Parameters
Name | Description |
---|---|
T | Table record type. |
InsertOrUpdate<T>(ITable<T>, Expression<Func<T>>, Nullable<Expression<Func<T, T>>>, Expression<Func<T>>)
Inserts new record into target table or updates existing record if record with the same key value already exists in target table.
When null
value or expression without field setters passed to onDuplicateKeyUpdateSetter
, this method
implements INSERT IF NOT EXISTS
logic.
Declaration
public static int InsertOrUpdate<T>(this ITable<T> target, Expression<Func<T>> insertSetter, Expression<Func<T, T>>? onDuplicateKeyUpdateSetter, Expression<Func<T>> keySelector)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Target table. |
Expression<Func<T>> | insertSetter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
System.Nullable<Expression<Func<T, T>>> | onDuplicateKeyUpdateSetter | Updated record constructor expression. Expression supports only target table record new expression with field initializers. Accepts updated record as parameter. |
Expression<Func<T>> | keySelector | Key fields selector to specify what fields and values must be used as key fields for selection between insert and update operations. Expression supports only target table record new expression with field initializers for each key field. Assigned key field value will be used as key value by operation type selector. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. |
Type Parameters
Name | Description |
---|---|
T | Table record type. |
InsertOrUpdateAsync<T>(ITable<T>, Expression<Func<T>>, Nullable<Expression<Func<T, T>>>, CancellationToken)
Asynchronously inserts new record into target table or updates existing record if record with the same primary key value already exists in target table.
When null
value or expression without field setters passed to onDuplicateKeyUpdateSetter
, this method
implements INSERT IF NOT EXISTS
logic.
Declaration
public static async Task<int> InsertOrUpdateAsync<T>(this ITable<T> target, Expression<Func<T>> insertSetter, Expression<Func<T, T>>? onDuplicateKeyUpdateSetter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Target table. |
Expression<Func<T>> | insertSetter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
System.Nullable<Expression<Func<T, T>>> | onDuplicateKeyUpdateSetter | Updated record constructor expression. Expression supports only target table record new expression with field initializers. Accepts updated record as parameter. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
T | Table record type. |
InsertOrUpdateAsync<T>(ITable<T>, Expression<Func<T>>, Nullable<Expression<Func<T, T>>>, Expression<Func<T>>, CancellationToken)
Asynchronously inserts new record into target table or updates existing record if record with the same key value already exists in target table.
When null
value or expression without field setters passed to onDuplicateKeyUpdateSetter
, this method
implements INSERT IF NOT EXISTS
logic.
Declaration
public static async Task<int> InsertOrUpdateAsync<T>(this ITable<T> target, Expression<Func<T>> insertSetter, Expression<Func<T, T>>? onDuplicateKeyUpdateSetter, Expression<Func<T>> keySelector, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Target table. |
Expression<Func<T>> | insertSetter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
System.Nullable<Expression<Func<T, T>>> | onDuplicateKeyUpdateSetter | Updated record constructor expression. Expression supports only target table record new expression with field initializers. Accepts updated record as parameter. |
Expression<Func<T>> | keySelector | Key fields selector to specify what fields and values must be used as key fields for selection between insert and update operations. Expression supports only target table record new expression with field initializers for each key field. Assigned key field value will be used as key value by operation type selector. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
T | Table record type. |
InsertWhenNotMatched<TTarget>(IMergeableSource<TTarget, TTarget>)
Adds new insert operation to merge and returns new merge command with added operation. This operation inserts new record to target table using data from the same fields of source record for each new record from source, not processed by previous operations.
Declaration
public static IMergeable<TTarget, TTarget> InsertWhenNotMatched<TTarget>(this IMergeableSource<TTarget, TTarget> merge)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TTarget> | merge | Merge command builder interface. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TTarget> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target and source records type. |
InsertWhenNotMatched<TTarget, TSource>(IMergeableSource<TTarget, TSource>, Expression<Func<TSource, TTarget>>)
Adds new insert operation to merge and returns new merge command with added operation. This operation inserts new record to target table using user-defined values for target columns for each new record from source, not processed by previous operations.
Declaration
public static IMergeable<TTarget, TSource> InsertWhenNotMatched<TTarget, TSource>(this IMergeableSource<TTarget, TSource> merge, Expression<Func<TSource, TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TSource> | merge | Merge command builder interface. |
Expression<Func<TSource, TTarget>> | setter | Create record expression using source record. Expression should be a call to target record constructor with field/properties initializers to be recognized by API. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TSource> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
InsertWhenNotMatchedAnd<TTarget>(IMergeableSource<TTarget, TTarget>, Expression<Func<TTarget, Boolean>>)
Adds new insert operation to merge and returns new merge command with added operation. This operation inserts new record to target table using data from the same fields of source record for each new record from source that passes filtering with specified predicate, if it wasn't processed by previous operations.
Declaration
public static IMergeable<TTarget, TTarget> InsertWhenNotMatchedAnd<TTarget>(this IMergeableSource<TTarget, TTarget> merge, Expression<Func<TTarget, bool>> searchCondition)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TTarget> | merge | Merge command builder interface. |
Expression<Func<TTarget, System.Boolean>> | searchCondition | Operation execution condition over source record. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TTarget> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target and source records type. |
InsertWhenNotMatchedAnd<TTarget, TSource>(IMergeableSource<TTarget, TSource>, Expression<Func<TSource, Boolean>>, Expression<Func<TSource, TTarget>>)
Adds new insert operation to merge and returns new merge command with added operation. This operation inserts new record to target table using user-defined values for target columns for each new record from source that passes filtering with specified predicate, if it wasn't processed by previous operations.
Declaration
public static IMergeable<TTarget, TSource> InsertWhenNotMatchedAnd<TTarget, TSource>(this IMergeableSource<TTarget, TSource> merge, Expression<Func<TSource, bool>> searchCondition, Expression<Func<TSource, TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TSource> | merge | Merge command builder interface. |
Expression<Func<TSource, System.Boolean>> | searchCondition | Operation execution condition over source record. |
Expression<Func<TSource, TTarget>> | setter | Create record expression using source record. Expression should be a call to target record constructor with field/properties initializers to be recognized by API. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TSource> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
InsertWithDecimalIdentity<T>(ITable<T>, Expression<Func<T>>)
Inserts single record into target table and returns identity value of inserted record as
Declaration
public static decimal InsertWithDecimalIdentity<T>(this ITable<T> target, Expression<Func<T>> setter)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Target table. |
Expression<Func<T>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Decimal | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Inserted record type. |
InsertWithDecimalIdentity<T>(IValueInsertable<T>)
Executes insert query and returns identity value of inserted record as
Declaration
public static decimal? InsertWithDecimalIdentity<T>(this IValueInsertable<T> source)
Parameters
Type | Name | Description |
---|---|---|
IValueInsertable<T> | source | Insert query. |
Returns
Type | Description |
---|---|
System.Nullable<System.Decimal> | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Target table record type. |
InsertWithDecimalIdentity<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>)
Inserts records from source query into target table and returns identity value of last inserted record as
Declaration
public static decimal? InsertWithDecimalIdentity<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Nullable<System.Decimal> | Last inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type |
InsertWithDecimalIdentity<TSource, TTarget>(ISelectInsertable<TSource, TTarget>)
Executes configured insert query and returns identity value of last inserted record as
Declaration
public static decimal? InsertWithDecimalIdentity<TSource, TTarget>(this ISelectInsertable<TSource, TTarget> source)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
Returns
Type | Description |
---|---|
System.Nullable<System.Decimal> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
InsertWithDecimalIdentityAsync<T>(ITable<T>, Expression<Func<T>>, CancellationToken)
Inserts single record into target table asynchronously and returns identity value of inserted record as
Declaration
public static async Task<decimal> InsertWithDecimalIdentityAsync<T>(this ITable<T> target, Expression<Func<T>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Target table. |
Expression<Func<T>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Decimal> | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Inserted record type. |
InsertWithDecimalIdentityAsync<T>(IValueInsertable<T>, CancellationToken)
Executes insert query asynchronously and returns identity value of inserted record as
Declaration
public static async Task<decimal?> InsertWithDecimalIdentityAsync<T>(this IValueInsertable<T> source, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IValueInsertable<T> | source | Insert query. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Nullable<System.Decimal>> | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Target table record type. |
InsertWithDecimalIdentityAsync<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, CancellationToken)
Inserts records from source query into target table asynchronously and returns identity value of last inserted record as
Declaration
public static async Task<decimal?> InsertWithDecimalIdentityAsync<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Nullable<System.Decimal>> | Last inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type |
InsertWithDecimalIdentityAsync<TSource, TTarget>(ISelectInsertable<TSource, TTarget>, CancellationToken)
Executes configured insert query asynchronously and returns identity value of last inserted record as
Declaration
public static async Task<decimal?> InsertWithDecimalIdentityAsync<TSource, TTarget>(this ISelectInsertable<TSource, TTarget> source, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Nullable<System.Decimal>> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
InsertWithIdentity<T>(ITable<T>, Expression<Func<T>>)
Inserts single record into target table and returns identity value of inserted record.
Declaration
public static object InsertWithIdentity<T>(this ITable<T> target, Expression<Func<T>> setter)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Target table. |
Expression<Func<T>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Object | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Inserted record type. |
InsertWithIdentity<T>(IValueInsertable<T>)
Executes insert query and returns identity value of inserted record.
Declaration
public static object InsertWithIdentity<T>(this IValueInsertable<T> source)
Parameters
Type | Name | Description |
---|---|---|
IValueInsertable<T> | source | Insert query. |
Returns
Type | Description |
---|---|
System.Object | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Target table record type. |
InsertWithIdentity<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>)
Inserts records from source query into target table and returns identity value of last inserted record.
Declaration
public static object InsertWithIdentity<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Object | Last inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type |
InsertWithIdentity<TSource, TTarget>(ISelectInsertable<TSource, TTarget>)
Executes configured insert query and returns identity value of last inserted record.
Declaration
public static object InsertWithIdentity<TSource, TTarget>(this ISelectInsertable<TSource, TTarget> source)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
Returns
Type | Description |
---|---|
System.Object | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
InsertWithIdentityAsync<T>(ITable<T>, Expression<Func<T>>, CancellationToken)
Inserts single record into target table asynchronously and returns identity value of inserted record.
Declaration
public static async Task<object> InsertWithIdentityAsync<T>(this ITable<T> target, Expression<Func<T>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Target table. |
Expression<Func<T>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Object> | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Inserted record type. |
InsertWithIdentityAsync<T>(IValueInsertable<T>, CancellationToken)
Executes insert query asynchronously and returns identity value of inserted record.
Declaration
public static async Task<object> InsertWithIdentityAsync<T>(this IValueInsertable<T> source, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IValueInsertable<T> | source | Insert query. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Object> | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Target table record type. |
InsertWithIdentityAsync<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, CancellationToken)
Inserts records from source query into target table asynchronously and returns identity value of last inserted record.
Declaration
public static async Task<object> InsertWithIdentityAsync<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Object> | Last inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type |
InsertWithIdentityAsync<TSource, TTarget>(ISelectInsertable<TSource, TTarget>, CancellationToken)
Executes configured insert query asynchronously and returns identity value of last inserted record.
Declaration
public static async Task<object> InsertWithIdentityAsync<TSource, TTarget>(this ISelectInsertable<TSource, TTarget> source, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Object> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
InsertWithInt32Identity<T>(ITable<T>, Expression<Func<T>>)
Inserts single record into target table and returns identity value of inserted record as
Declaration
public static int InsertWithInt32Identity<T>(this ITable<T> target, Expression<Func<T>> setter)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Target table. |
Expression<Func<T>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Int32 | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Inserted record type. |
InsertWithInt32Identity<T>(IValueInsertable<T>)
Executes insert query and returns identity value of inserted record as
Declaration
public static int? InsertWithInt32Identity<T>(this IValueInsertable<T> source)
Parameters
Type | Name | Description |
---|---|---|
IValueInsertable<T> | source | Insert query. |
Returns
Type | Description |
---|---|
System.Nullable<System.Int32> | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Target table record type. |
InsertWithInt32Identity<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>)
Inserts records from source query into target table and returns identity value of last inserted record as
Declaration
public static int? InsertWithInt32Identity<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Nullable<System.Int32> | Last inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type |
InsertWithInt32Identity<TSource, TTarget>(ISelectInsertable<TSource, TTarget>)
Executes configured insert query and returns identity value of last inserted record as
Declaration
public static int? InsertWithInt32Identity<TSource, TTarget>(this ISelectInsertable<TSource, TTarget> source)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
Returns
Type | Description |
---|---|
System.Nullable<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
InsertWithInt32IdentityAsync<T>(ITable<T>, Expression<Func<T>>, CancellationToken)
Inserts single record into target table asynchronously and returns identity value of inserted record as
Declaration
public static async Task<int> InsertWithInt32IdentityAsync<T>(this ITable<T> target, Expression<Func<T>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Target table. |
Expression<Func<T>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Inserted record type. |
InsertWithInt32IdentityAsync<T>(IValueInsertable<T>, CancellationToken)
Executes insert query asynchronously and returns identity value of inserted record as
Declaration
public static async Task<int?> InsertWithInt32IdentityAsync<T>(this IValueInsertable<T> source, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IValueInsertable<T> | source | Insert query. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Nullable<System.Int32>> | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Target table record type. |
InsertWithInt32IdentityAsync<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, CancellationToken)
Inserts records from source query into target table asynchronously and returns identity value of last inserted record as
Declaration
public static async Task<int?> InsertWithInt32IdentityAsync<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Nullable<System.Int32>> | Last inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type |
InsertWithInt32IdentityAsync<TSource, TTarget>(ISelectInsertable<TSource, TTarget>, CancellationToken)
Executes configured insert query asynchronously and returns identity value of last inserted record as
Declaration
public static async Task<int?> InsertWithInt32IdentityAsync<TSource, TTarget>(this ISelectInsertable<TSource, TTarget> source, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Nullable<System.Int32>> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
InsertWithInt64Identity<T>(ITable<T>, Expression<Func<T>>)
Inserts single record into target table and returns identity value of inserted record as
Declaration
public static long InsertWithInt64Identity<T>(this ITable<T> target, Expression<Func<T>> setter)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Target table. |
Expression<Func<T>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Int64 | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Inserted record type. |
InsertWithInt64Identity<T>(IValueInsertable<T>)
Executes insert query and returns identity value of inserted record as
Declaration
public static long? InsertWithInt64Identity<T>(this IValueInsertable<T> source)
Parameters
Type | Name | Description |
---|---|---|
IValueInsertable<T> | source | Insert query. |
Returns
Type | Description |
---|---|
System.Nullable<System.Int64> | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Target table record type. |
InsertWithInt64Identity<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>)
Inserts records from source query into target table and returns identity value of last inserted record as
Declaration
public static long? InsertWithInt64Identity<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Nullable<System.Int64> | Last inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type |
InsertWithInt64Identity<TSource, TTarget>(ISelectInsertable<TSource, TTarget>)
Executes configured insert query and returns identity value of last inserted record as
Declaration
public static long? InsertWithInt64Identity<TSource, TTarget>(this ISelectInsertable<TSource, TTarget> source)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
Returns
Type | Description |
---|---|
System.Nullable<System.Int64> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
InsertWithInt64IdentityAsync<T>(ITable<T>, Expression<Func<T>>, CancellationToken)
Inserts single record into target table asynchronously and returns identity value of inserted record as
Declaration
public static async Task<long> InsertWithInt64IdentityAsync<T>(this ITable<T> target, Expression<Func<T>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Target table. |
Expression<Func<T>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int64> | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Inserted record type. |
InsertWithInt64IdentityAsync<T>(IValueInsertable<T>, CancellationToken)
Executes insert query asynchronously and returns identity value of inserted record as
Declaration
public static async Task<long?> InsertWithInt64IdentityAsync<T>(this IValueInsertable<T> source, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IValueInsertable<T> | source | Insert query. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Nullable<System.Int64>> | Inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
T | Target table record type. |
InsertWithInt64IdentityAsync<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, CancellationToken)
Inserts records from source query into target table asynchronously and returns identity value of last inserted record as
Declaration
public static async Task<long?> InsertWithInt64IdentityAsync<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Nullable<System.Int64>> | Last inserted record's identity value. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type |
InsertWithInt64IdentityAsync<TSource, TTarget>(ISelectInsertable<TSource, TTarget>, CancellationToken)
Executes configured insert query asynchronously and returns identity value of last inserted record as
Declaration
public static async Task<long?> InsertWithInt64IdentityAsync<TSource, TTarget>(this ISelectInsertable<TSource, TTarget> source, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Nullable<System.Int64>> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
InsertWithOutput<TTarget>(ITable<TTarget>, TTarget)
Inserts single record into target table and returns inserted record.
Declaration
public static TTarget InsertWithOutput<TTarget>(this ITable<TTarget> target, TTarget obj)
Parameters
Type | Name | Description |
---|---|---|
ITable<TTarget> | target | Target table. |
TTarget | obj | Object with data to insert. |
Returns
Type | Description |
---|---|
TTarget | Inserted record. |
Type Parameters
Name | Description |
---|---|
TTarget | Inserted record type. |
Remarks
Database support:
InsertWithOutput<TTarget>(ITable<TTarget>, Expression<Func<TTarget>>)
Inserts single record into target table and returns inserted record.
Declaration
public static TTarget InsertWithOutput<TTarget>(this ITable<TTarget> target, Expression<Func<TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
ITable<TTarget> | target | Target table. |
Expression<Func<TTarget>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
TTarget | Inserted record. |
Type Parameters
Name | Description |
---|---|
TTarget | Inserted record type. |
Remarks
Database support:
InsertWithOutput<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>)
Inserts records from source query into target table and returns newly created records.
Declaration
public static IEnumerable<TTarget> InsertWithOutput<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
IEnumerable<TTarget> | Enumeration of records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
Remarks
Database support:
InsertWithOutput<TTarget, TOutput>(ITable<TTarget>, Expression<Func<TTarget>>, Expression<Func<TTarget, TOutput>>)
Inserts single record into target table and returns inserted record.
Declaration
public static TOutput InsertWithOutput<TTarget, TOutput>(this ITable<TTarget> target, Expression<Func<TTarget>> setter, Expression<Func<TTarget, TOutput>> outputExpression)
Parameters
Type | Name | Description |
---|---|---|
ITable<TTarget> | target | Target table. |
Expression<Func<TTarget>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
Expression<Func<TTarget, TOutput>> | outputExpression | Output record constructor expression. Expression supports only record new expression with field initializers. |
Returns
Type | Description |
---|---|
TOutput | Inserted record. |
Type Parameters
Name | Description |
---|---|
TTarget | Inserted record type. |
TOutput | Output table record type. |
Remarks
Database support:
InsertWithOutput<TSource, TTarget>(ISelectInsertable<TSource, TTarget>)
Executes configured insert query and returns inserted record.
Declaration
public static TTarget InsertWithOutput<TSource, TTarget>(this ISelectInsertable<TSource, TTarget> source)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
Returns
Type | Description |
---|---|
TTarget | Inserted record. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
Remarks
Database support:
InsertWithOutput<TSource, TTarget, TOutput>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, Expression<Func<TTarget, TOutput>>)
Inserts records from source query into target table and returns newly created records.
Declaration
public static IEnumerable<TOutput> InsertWithOutput<TSource, TTarget, TOutput>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, Expression<Func<TTarget, TOutput>> outputExpression)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
Expression<Func<TTarget, TOutput>> | outputExpression | Output record constructor expression. Expression supports only record new expression with field initializers. |
Returns
Type | Description |
---|---|
IEnumerable<TOutput> | Enumeration of records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
TOutput | Output table record type. |
Remarks
Database support:
InsertWithOutputAsync<TTarget>(ITable<TTarget>, TTarget, CancellationToken)
Inserts single record into target table asynchronously and returns inserted record.
Declaration
public static Task<TTarget> InsertWithOutputAsync<TTarget>(this ITable<TTarget> target, TTarget obj, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ITable<TTarget> | target | Target table. |
TTarget | obj | Object with data to insert. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<TTarget> | Inserted record. |
Type Parameters
Name | Description |
---|---|
TTarget | Inserted record type. |
Remarks
Database support:
InsertWithOutputAsync<TTarget>(ITable<TTarget>, Expression<Func<TTarget>>, CancellationToken)
Inserts single record into target table asynchronously and returns inserted record.
Declaration
public static Task<TTarget> InsertWithOutputAsync<TTarget>(this ITable<TTarget> target, Expression<Func<TTarget>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ITable<TTarget> | target | Target table. |
Expression<Func<TTarget>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<TTarget> | Inserted record. |
Type Parameters
Name | Description |
---|---|
TTarget | Inserted record type. |
Remarks
Database support:
InsertWithOutputAsync<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, CancellationToken)
Inserts records from source query into target table asynchronously and returns newly created records.
Declaration
public static Task<TTarget[]> InsertWithOutputAsync<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<TTarget[]> | Array of records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
Remarks
Database support:
InsertWithOutputAsync<TTarget, TOutput>(ITable<TTarget>, Expression<Func<TTarget>>, Expression<Func<TTarget, TOutput>>, CancellationToken)
Inserts single record into target table asynchronously and returns inserted record.
Declaration
public static Task<TOutput> InsertWithOutputAsync<TTarget, TOutput>(this ITable<TTarget> target, Expression<Func<TTarget>> setter, Expression<Func<TTarget, TOutput>> outputExpression, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ITable<TTarget> | target | Target table. |
Expression<Func<TTarget>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
Expression<Func<TTarget, TOutput>> | outputExpression | Output record constructor expression. Expression supports only record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<TOutput> | Inserted record. |
Type Parameters
Name | Description |
---|---|
TTarget | Inserted record type. |
TOutput | Output table record type. |
Remarks
Database support:
InsertWithOutputAsync<TSource, TTarget>(ISelectInsertable<TSource, TTarget>, CancellationToken)
Executes configured insert query asynchronously and returns inserted record.
Declaration
public static Task<TTarget> InsertWithOutputAsync<TSource, TTarget>(this ISelectInsertable<TSource, TTarget> source, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<TTarget> | Inserted record. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
Remarks
Database support:
InsertWithOutputAsync<TSource, TTarget, TOutput>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, Expression<Func<TTarget, TOutput>>, CancellationToken)
Inserts records from source query into target table asynchronously and returns newly created records.
Declaration
public static Task<TOutput[]> InsertWithOutputAsync<TSource, TTarget, TOutput>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, Expression<Func<TTarget, TOutput>> outputExpression, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
Expression<Func<TTarget, TOutput>> | outputExpression | Output record constructor expression. Expression supports only record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<TOutput[]> | Array of records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
TOutput | Output table record type. |
Remarks
Database support:
InsertWithOutputInto<TTarget>(ITable<TTarget>, Expression<Func<TTarget>>, ITable<TTarget>)
Inserts single record into target table and outputs that record into outputTable
.
Declaration
public static int InsertWithOutputInto<TTarget>(this ITable<TTarget> target, Expression<Func<TTarget>> setter, ITable<TTarget> outputTable)
Parameters
Type | Name | Description |
---|---|---|
ITable<TTarget> | target | Target table. |
Expression<Func<TTarget>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
ITable<TTarget> | outputTable | Output table. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TTarget | Inserted record type. |
Remarks
Database support:
InsertWithOutputInto<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, ITable<TTarget>)
Inserts records from source query into target table and outputs newly created records into outputTable
.
Declaration
public static int InsertWithOutputInto<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, ITable<TTarget> outputTable)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
ITable<TTarget> | outputTable | Output table. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
Remarks
Database support:
InsertWithOutputInto<TTarget, TOutput>(ITable<TTarget>, Expression<Func<TTarget>>, ITable<TOutput>, Expression<Func<TTarget, TOutput>>)
Inserts single record into target table and outputs that record into outputTable
.
Declaration
public static int InsertWithOutputInto<TTarget, TOutput>(this ITable<TTarget> target, Expression<Func<TTarget>> setter, ITable<TOutput> outputTable, Expression<Func<TTarget, TOutput>> outputExpression)
Parameters
Type | Name | Description |
---|---|---|
ITable<TTarget> | target | Target table. |
Expression<Func<TTarget>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
ITable<TOutput> | outputTable | Output table. |
Expression<Func<TTarget, TOutput>> | outputExpression | Output record constructor expression. Expression supports only record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TTarget | Inserted record type. |
TOutput | Output table record type. |
Remarks
Database support:
InsertWithOutputInto<TSource, TTarget>(ISelectInsertable<TSource, TTarget>, ITable<TTarget>)
Executes configured insert query and returns inserted record.
Declaration
public static int InsertWithOutputInto<TSource, TTarget>(this ISelectInsertable<TSource, TTarget> source, ITable<TTarget> outputTable)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
ITable<TTarget> | outputTable | Output table. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
Remarks
Database support:
InsertWithOutputInto<TSource, TTarget, TOutput>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, ITable<TOutput>, Expression<Func<TTarget, TOutput>>)
Inserts records from source query into target table and outputs inserted records into outputTable
.
Declaration
public static int InsertWithOutputInto<TSource, TTarget, TOutput>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, ITable<TOutput> outputTable, Expression<Func<TTarget, TOutput>> outputExpression)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
ITable<TOutput> | outputTable | Output table. |
Expression<Func<TTarget, TOutput>> | outputExpression | Output record constructor expression. Expression supports only record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
TOutput | Output table record type. |
Remarks
Database support:
InsertWithOutputIntoAsync<TTarget>(ITable<TTarget>, Expression<Func<TTarget>>, ITable<TTarget>, CancellationToken)
Inserts single record into target table asynchronously and outputs that record into outputTable
.
Declaration
public static Task<int> InsertWithOutputIntoAsync<TTarget>(this ITable<TTarget> target, Expression<Func<TTarget>> setter, ITable<TTarget> outputTable, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ITable<TTarget> | target | Target table. |
Expression<Func<TTarget>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
ITable<TTarget> | outputTable | Output table. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TTarget | Inserted record type. |
Remarks
Database support:
InsertWithOutputIntoAsync<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, ITable<TTarget>, CancellationToken)
Inserts records from source query into target table asynchronously and outputs inserted records into outputTable
.
Declaration
public static Task<int> InsertWithOutputIntoAsync<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, ITable<TTarget> outputTable, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
ITable<TTarget> | outputTable | Output table. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
Remarks
Database support:
InsertWithOutputIntoAsync<TTarget, TOutput>(ITable<TTarget>, Expression<Func<TTarget>>, ITable<TOutput>, Expression<Func<TTarget, TOutput>>, CancellationToken)
Inserts single record into target table asynchronously and outputs that record into outputTable
.
Declaration
public static Task<int> InsertWithOutputIntoAsync<TTarget, TOutput>(this ITable<TTarget> target, Expression<Func<TTarget>> setter, ITable<TOutput> outputTable, Expression<Func<TTarget, TOutput>> outputExpression, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ITable<TTarget> | target | Target table. |
Expression<Func<TTarget>> | setter | Insert expression. Expression supports only target table record new expression with field initializers. |
ITable<TOutput> | outputTable | Output table. |
Expression<Func<TTarget, TOutput>> | outputExpression | Output record constructor expression. Expression supports only record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TTarget | Inserted record type. |
TOutput | Output table record type. |
Remarks
Database support:
InsertWithOutputIntoAsync<TSource, TTarget>(ISelectInsertable<TSource, TTarget>, ITable<TTarget>, CancellationToken)
Executes configured insert query asynchronously and returns inserted record.
Declaration
public static Task<int> InsertWithOutputIntoAsync<TSource, TTarget>(this ISelectInsertable<TSource, TTarget> source, ITable<TTarget> outputTable, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
ITable<TTarget> | outputTable | Output table. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
Remarks
Database support:
InsertWithOutputIntoAsync<TSource, TTarget, TOutput>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, ITable<TOutput>, Expression<Func<TTarget, TOutput>>, CancellationToken)
Inserts records from source query into target table asynchronously and outputs inserted records into outputTable
.
Declaration
public static Task<int> InsertWithOutputIntoAsync<TSource, TTarget, TOutput>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, ITable<TOutput> outputTable, Expression<Func<TTarget, TOutput>> outputExpression, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query, that returns data for insert operation. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Inserted record constructor expression. Expression supports only target table record new expression with field initializers. |
ITable<TOutput> | outputTable | Output table. |
Expression<Func<TTarget, TOutput>> | outputExpression | Output record constructor expression. Expression supports only record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table record type. |
TOutput | Output table record type. |
Remarks
Database support:
IntersectAll<TSource>(IQueryable<TSource>, IEnumerable<TSource>)
Produces the set intersection of two sequences.
Declaration
public static IQueryable<TSource> IntersectAll<TSource>(this IQueryable<TSource> source1, IEnumerable<TSource> source2)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source1 | A sequence whose elements that also appear in |
IEnumerable<TSource> | source2 | A sequence whose elements that also appear in the first sequence are returned. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | A sequence that contains the set intersection of the two sequences. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the input sequences. |
Into<T>(IDataContext, ITable<T>)
Starts insert operation LINQ query definition.
Declaration
public static IValueInsertable<T> Into<T>(this IDataContext dataContext, ITable<T> target)
Parameters
Type | Name | Description |
---|---|---|
IDataContext | dataContext | Database connection context. |
ITable<T> | target | Target table. |
Returns
Type | Description |
---|---|
IValueInsertable<T> | Insertable source query. |
Type Parameters
Name | Description |
---|---|
T | Target table mapping class. |
Into<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>)
Converts LINQ query into insert query with source query data as data to insert.
Declaration
public static ISelectInsertable<TSource, TTarget> Into<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
ITable<TTarget> | target | Target table. |
Returns
Type | Description |
---|---|
ISelectInsertable<TSource, TTarget> | Insertable source query. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
IsSet(TableOptions)
Declaration
public static bool IsSet(this TableOptions tableOptions)
Parameters
Type | Name | Description |
---|---|---|
TableOptions | tableOptions |
Returns
Type | Description |
---|---|
System.Boolean |
IsTemporaryOptionSet(TableOptions)
Declaration
public static bool IsTemporaryOptionSet(this TableOptions tableOptions)
Parameters
Type | Name | Description |
---|---|---|
TableOptions | tableOptions |
Returns
Type | Description |
---|---|
System.Boolean |
Join<TSource>(IQueryable<TSource>, SqlJoinType, Expression<Func<TSource, Boolean>>)
Defines inner or outer join between two sub-queries or tables.
Declaration
public static IQueryable<TSource> Join<TSource>(this IQueryable<TSource> source, SqlJoinType joinType, Expression<Func<TSource, bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Right join operand. |
SqlJoinType | joinType | Type of join. |
Expression<Func<TSource, System.Boolean>> | predicate | Join predicate. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Right operand. |
Type Parameters
Name | Description |
---|---|
TSource | Type of record for right join operand. |
Join<TOuter, TInner, TResult>(IQueryable<TOuter>, IQueryable<TInner>, SqlJoinType, Expression<Func<TOuter, TInner, Boolean>>, Expression<Func<TOuter, TInner, TResult>>)
Defines inner or outer join between two sub-queries or tables.
Declaration
public static IQueryable<TResult> Join<TOuter, TInner, TResult>(this IQueryable<TOuter> outer, IQueryable<TInner> inner, SqlJoinType joinType, Expression<Func<TOuter, TInner, bool>> predicate, Expression<Func<TOuter, TInner, TResult>> resultSelector)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TOuter> | outer | Left join operand. |
IQueryable<TInner> | inner | Right join operand. |
SqlJoinType | joinType | Type of join. |
Expression<Func<TOuter, TInner, System.Boolean>> | predicate | Join predicate. |
Expression<Func<TOuter, TInner, TResult>> | resultSelector | A function to create a result element from two matching elements. |
Returns
Type | Description |
---|---|
IQueryable<TResult> | Right operand. |
Type Parameters
Name | Description |
---|---|
TOuter | Type of record for left join operand. |
TInner | Type of record for right join operand. |
TResult | The type of the result elements. |
JoinHint<TSource>(IQueryable<TSource>, String)
Adds a join hint to a generated query.
Declaration
public static IQueryable<TSource> JoinHint<TSource>(this IQueryable<TSource> source, string hint)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query source with join hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
LeftJoin<TSource>(IQueryable<TSource>, Expression<Func<TSource, Boolean>>)
Defines left outer join between two sub-queries or tables.
Declaration
public static IQueryable<TSource> LeftJoin<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Right join operand. |
Expression<Func<TSource, System.Boolean>> | predicate | Join predicate. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Right operand. |
Type Parameters
Name | Description |
---|---|
TSource | Type of record for right join operand. |
LeftJoin<TOuter, TInner, TResult>(IQueryable<TOuter>, IQueryable<TInner>, Expression<Func<TOuter, TInner, Boolean>>, Expression<Func<TOuter, TInner, TResult>>)
Defines left outer join between two sub-queries or tables.
Declaration
public static IQueryable<TResult> LeftJoin<TOuter, TInner, TResult>(this IQueryable<TOuter> outer, IQueryable<TInner> inner, Expression<Func<TOuter, TInner, bool>> predicate, Expression<Func<TOuter, TInner, TResult>> resultSelector)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TOuter> | outer | Left join operand. |
IQueryable<TInner> | inner | Right join operand. |
Expression<Func<TOuter, TInner, System.Boolean>> | predicate | Join predicate. |
Expression<Func<TOuter, TInner, TResult>> | resultSelector | A function to create a result element from two matching elements. |
Returns
Type | Description |
---|---|
IQueryable<TResult> | Right operand. |
Type Parameters
Name | Description |
---|---|
TOuter | Type of record for left join operand. |
TInner | Type of record for right join operand. |
TResult | The type of the result elements. |
LoadWith<TEntity, TProperty>(IQueryable<TEntity>, Expression<Func<TEntity, TProperty>>)
Specifies associations that should be loaded for each loaded record from current table.
All associations, specified in selector
expression, will be loaded.
Take into account that use of this method could require multiple queries to load all requested associations.
Declaration
public static ILoadWithQueryable<TEntity, TProperty> LoadWith<TEntity, TProperty>(this IQueryable<TEntity> source, Expression<Func<TEntity, TProperty>> selector)
where TEntity : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TEntity> | source | The source query. |
Expression<Func<TEntity, TProperty>> | selector | A lambda expression representing navigation property to be included ( |
Returns
Type | Description |
---|---|
ILoadWithQueryable<TEntity, TProperty> | Returns new query with related data included. |
Type Parameters
Name | Description |
---|---|
TEntity | Type of entity being queried. |
TProperty | Type of the related entity to be included. |
Examples
Following query loads records from Table1 with Reference association, loaded for each Table1 record.
db.Table1.LoadWith(r => r.Reference);
Following queries loads records from Table1 with Reference1 association and then loads records from Reference2 association for each loaded Reference1 record.
db.Table1.LoadWith(r => r.Reference1.Reference2);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.Reference1).ThenLoad(r => r.Reference2);
Following query loads records from Table1 with References collection association loaded for each Table1 record.
db.Table1.LoadWith(r => r.References);
Following query loads records from Table1 with References collection association loaded for each Table1 record. Also it limits loaded records.
db.Table1.LoadWith(r => r.References.Where(e => !e.IsDeleted).Take(10));
Following query loads records from Table1 with: - Reference1 collection association loaded for each Table1 record; - Reference2 collection association for each loaded Reference1 record; - Reference3 association for each loaded Reference2 record.
Note that a way you access collection association record (by index, using First() method) doesn't affect query results and always select all records.
db.Table1.LoadWith(r => r.References1[0].References2.First().Reference3);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.References1).ThenLoad(r => r.References2).ThenLoad(r => r.Reference3);
|
Improve this Doc
View Source
LoadWith<TEntity, TProperty>(IQueryable<TEntity>, Expression<Func<TEntity, TProperty>>, Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>>)
Specifies associations that should be loaded for each loaded record from current table.
All associations, specified in selector
expression, will be loaded.
Take into account that use of this method could require multiple queries to load all requested associations.
loadFunc
parameter could be used to define additional association loading logic like filters or loading of more associations.
Declaration
public static ILoadWithQueryable<TEntity, TProperty> LoadWith<TEntity, TProperty>(this IQueryable<TEntity> source, Expression<Func<TEntity, TProperty>> selector, Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>> loadFunc)
where TEntity : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TEntity> | source | The source query. |
Expression<Func<TEntity, TProperty>> | selector | A lambda expression representing navigation property to be included ( |
Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>> | loadFunc | Defines additional logic for association load query. |
Returns
Type | Description |
---|---|
ILoadWithQueryable<TEntity, TProperty> | Returns new query with related data included. |
Type Parameters
Name | Description |
---|---|
TEntity | Type of entity being queried. |
TProperty | Type of the related entity to be included. |
Examples
Following query loads records from Table1 with Reference association, loaded for each Table1 record.
db.Table1.LoadWith(r => r.Reference);
Following queries loads records from Table1 with Reference1 association and then loads records from Reference2 association for each loaded Reference1 record.
db.Table1.LoadWith(r => r.Reference1.Reference2);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.Reference1).ThenLoad(r => r.Reference2);
Following query loads records from Table1 with References collection association loaded for each Table1 record.
db.Table1.LoadWith(r => r.References);
Following query loads records from Table1 with: - Reference1 collection association loaded for each Table1 record; - Reference2 collection association for each loaded Reference1 record; - Reference3 association for each loaded Reference2 record.
Note that a way you access collection association record (by index, using First() method) doesn't affect query results and always select all records.
db.Table1.LoadWith(r => r.References1[0].References2.First().Reference3);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.References1).ThenLoad(r => r.References2).ThenLoad(r => r.Reference3);
Following query loads records from Table1 with References collection association loaded for each Table1 record, where References record contains only records without "exclude" text in Name property.
db.Table1.LoadWith(r => r.References, r => r.Where(rr => !rr.Name.Contains("exclude")));
Following query loads records from Table1 with References1 collection association loaded for each Table1 record, where References1 record also load Reference2 association.
db.Table1.LoadWith(r => r.References1, r => r.LoadWith(rr => rr.Reference2));
|
Improve this Doc
View Source
LoadWith<TEntity, TProperty>(IQueryable<TEntity>, Expression<Func<TEntity, IEnumerable<TProperty>>>, Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>>)
Specifies associations that should be loaded for each loaded record from current table.
All associations, specified in selector
expression, will be loaded.
Take into account that use of this method could require multiple queries to load all requested associations.
loadFunc
parameter could be used to define additional association loading logic like filters or loading of more associations.
Declaration
public static ILoadWithQueryable<TEntity, TProperty> LoadWith<TEntity, TProperty>(this IQueryable<TEntity> source, Expression<Func<TEntity, IEnumerable<TProperty>>> selector, Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>> loadFunc)
where TEntity : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TEntity> | source | The source query. |
Expression<Func<TEntity, IEnumerable<TProperty>>> | selector | A lambda expression representing navigation property to be included ( |
Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>> | loadFunc | Defines additional logic for association load query. |
Returns
Type | Description |
---|---|
ILoadWithQueryable<TEntity, TProperty> | Returns new query with related data included. |
Type Parameters
Name | Description |
---|---|
TEntity | Type of entity being queried. |
TProperty | Type of the related entity to be included. |
Examples
Following query loads records from Table1 with Reference association, loaded for each Table1 record.
db.Table1.LoadWith(r => r.Reference);
Following queries loads records from Table1 with Reference1 association and then loads records from Reference2 association for each loaded Reference1 record.
db.Table1.LoadWith(r => r.Reference1.Reference2);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.Reference1).ThenLoad(r => r.Reference2);
Following query loads records from Table1 with References collection association loaded for each Table1 record.
db.Table1.LoadWith(r => r.References);
Following query loads records from Table1 with: - Reference1 collection association loaded for each Table1 record; - Reference2 collection association for each loaded Reference1 record; - Reference3 association for each loaded Reference2 record.
Note that a way you access collection association record (by index, using First() method) doesn't affect query results and always select all records.
db.Table1.LoadWith(r => r.References1[0].References2.First().Reference3);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.References1).ThenLoad(r => r.References2).ThenLoad(r => r.Reference3);
Following query loads records from Table1 with References collection association loaded for each Table1 record, where References record contains only records without "exclude" text in Name property.
db.Table1.LoadWith(r => r.References, r => r.Where(rr => !rr.Name.Contains("exclude")));
Following query loads records from Table1 with References1 collection association loaded for each Table1 record, where References1 record also load Reference2 association.
db.Table1.LoadWith(r => r.References1, r => r.LoadWith(rr => rr.Reference2));
|
Improve this Doc
View Source
LoadWithAsTable<T>(ITable<T>, Expression<Func<T, Nullable<Object>>>)
Specifies associations, that should be loaded for each loaded record from current table.
All associations, specified in selector
expression, will be loaded.
Take into account that use of this method could require multiple queries to load all requested associations.
Some usage examples:
// loads records from Table1 with Reference association loaded for each Table1 record
db.Table1.LoadWithAsTable(r => r.Reference);
// loads records from Table1 with Reference1 association loaded for each Table1 record
// loads records from Reference2 association for each loaded Reference1 record
db.Table1.LoadWithAsTable(r => r.Reference1.Reference2);
// loads records from Table1 with References collection association loaded for each Table1 record
db.Table1.LoadWithAsTable(r => r.References);
// loads records from Table1 with Reference1 collection association loaded for each Table1 record
// loads records from Reference2 collection association for each loaded Reference1 record
// loads records from Reference3 association for each loaded Reference2 record
// note that a way you access collection association record (by index, using First() method) doesn't affect
// query results and always select all records
db.Table1.LoadWithAsTable(r => r.References1[0].References2.First().Reference3);
Declaration
public static ITable<T> LoadWithAsTable<T>(this ITable<T> table, Expression<Func<T, object?>> selector)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | table | Table-like query source. |
Expression<Func<T, System.Nullable<System.Object>>> | selector | Association selection expression. |
Returns
Type | Description |
---|---|
ITable<T> | Table-like query source. |
Type Parameters
Name | Description |
---|---|
T | Table record mapping class. |
Merge<TTarget>(IQueryable<TTarget>)
Starts merge operation definition from a subquery. If the query is not a table or a cte, it will be converted into a cte as the merge target.
Declaration
public static IMergeableUsing<TTarget> Merge<TTarget>(this IQueryable<TTarget> target)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TTarget> | target | Target table. |
Returns
Type | Description |
---|---|
IMergeableUsing<TTarget> | Returns merge command builder, that contains only target. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
Merge<TTarget>(ITable<TTarget>)
Starts merge operation definition from target table.
Declaration
public static IMergeableUsing<TTarget> Merge<TTarget>(this ITable<TTarget> target)
Parameters
Type | Name | Description |
---|---|---|
ITable<TTarget> | target | Target table. |
Returns
Type | Description |
---|---|
IMergeableUsing<TTarget> | Returns merge command builder, that contains only target. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
Merge<TTarget>(ITable<TTarget>, String)
Starts merge operation definition from target table.
Declaration
public static IMergeableUsing<TTarget> Merge<TTarget>(this ITable<TTarget> target, string hint)
Parameters
Type | Name | Description |
---|---|---|
ITable<TTarget> | target | Target table. |
System.String | hint | Database-specific merge hint. |
Returns
Type | Description |
---|---|
IMergeableUsing<TTarget> | Returns merge command builder, that contains only target. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
Merge<TTarget, TSource>(IMergeable<TTarget, TSource>)
Executes merge command and returns total number of target records, affected by merge operations.
Declaration
public static int Merge<TTarget, TSource>(this IMergeable<TTarget, TSource> merge)
Parameters
Type | Name | Description |
---|---|---|
IMergeable<TTarget, TSource> | merge | Merge command definition. |
Returns
Type | Description |
---|---|
System.Int32 | Returns number of target table records, affected by merge command. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
MergeAsync<TTarget, TSource>(IMergeable<TTarget, TSource>, CancellationToken)
Executes merge command and returns total number of target records, affected by merge operations.
Declaration
public static Task<int> MergeAsync<TTarget, TSource>(this IMergeable<TTarget, TSource> merge, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IMergeable<TTarget, TSource> | merge | Merge command definition. |
CancellationToken | token | Asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Returns number of target table records, affected by merge command. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
MergeInto<TTarget, TSource>(IQueryable<TSource>, IQueryable<TTarget>)
Starts merge operation definition from source query.
Declaration
public static IMergeableOn<TTarget, TSource> MergeInto<TTarget, TSource>(this IQueryable<TSource> source, IQueryable<TTarget> target)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
IQueryable<TTarget> | target | Target query. If the query is not a table or a cte, it will be converted into a cte as the merge target. |
Returns
Type | Description |
---|---|
IMergeableOn<TTarget, TSource> | Returns merge command builder with source and target set. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
MergeInto<TTarget, TSource>(IQueryable<TSource>, ITable<TTarget>)
Starts merge operation definition from source query.
Declaration
public static IMergeableOn<TTarget, TSource> MergeInto<TTarget, TSource>(this IQueryable<TSource> source, ITable<TTarget> target)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
ITable<TTarget> | target | Target table. |
Returns
Type | Description |
---|---|
IMergeableOn<TTarget, TSource> | Returns merge command builder with source and target set. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
MergeInto<TTarget, TSource>(IQueryable<TSource>, ITable<TTarget>, String)
Starts merge operation definition from source query.
Declaration
public static IMergeableOn<TTarget, TSource> MergeInto<TTarget, TSource>(this IQueryable<TSource> source, ITable<TTarget> target, string hint)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
ITable<TTarget> | target | Target table. |
System.String | hint | Database-specific merge hint. |
Returns
Type | Description |
---|---|
IMergeableOn<TTarget, TSource> | Returns merge command builder with source and target set. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
MergeWithOutput<TTarget, TSource, TOutput>(IMergeable<TTarget, TSource>, Expression<Func<String, TTarget, TTarget, TOutput>>)
Executes merge command and returns output information, affected by merge operations.
Declaration
public static IEnumerable<TOutput> MergeWithOutput<TTarget, TSource, TOutput>(this IMergeable<TTarget, TSource> merge, Expression<Func<string, TTarget, TTarget, TOutput>> outputExpression)
Parameters
Type | Name | Description |
---|---|---|
IMergeable<TTarget, TSource> | merge | Merge command definition. |
Expression<Func<System.String, TTarget, TTarget, TOutput>> | outputExpression | Output record constructor expression. Expression supports only record new expression with field initializers. |
Returns
Type | Description |
---|---|
IEnumerable<TOutput> | Returns number of target table records, affected by merge command. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
TOutput | Output table record type. |
Remarks
Database support:
MergeWithOutputAsync<TTarget, TSource, TOutput>(IMergeable<TTarget, TSource>, Expression<Func<String, TTarget, TTarget, TOutput>>)
Executes merge command and returns output information, affected by merge operations.
Declaration
public static IAsyncEnumerable<TOutput> MergeWithOutputAsync<TTarget, TSource, TOutput>(this IMergeable<TTarget, TSource> merge, Expression<Func<string, TTarget, TTarget, TOutput>> outputExpression)
Parameters
Type | Name | Description |
---|---|---|
IMergeable<TTarget, TSource> | merge | Merge command definition. |
Expression<Func<System.String, TTarget, TTarget, TOutput>> | outputExpression | Output record constructor expression. Expression supports only record new expression with field initializers. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TOutput> | Returns number of target table records, affected by merge command. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
TOutput | Output table record type. |
Remarks
Database support:
MergeWithOutputInto<TTarget, TSource, TOutput>(IMergeable<TTarget, TSource>, ITable<TOutput>, Expression<Func<String, TTarget, TTarget, TOutput>>)
Executes merge command, inserts output information into table and returns total number of target records, affected by merge operations.
Declaration
public static int MergeWithOutputInto<TTarget, TSource, TOutput>(this IMergeable<TTarget, TSource> merge, ITable<TOutput> outputTable, Expression<Func<string, TTarget, TTarget, TOutput>> outputExpression)
Parameters
Type | Name | Description |
---|---|---|
IMergeable<TTarget, TSource> | merge | Merge command definition. |
ITable<TOutput> | outputTable | Table which should handle output result. |
Expression<Func<System.String, TTarget, TTarget, TOutput>> | outputExpression | Output record constructor expression. Expression supports only record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Int32 | Returns number of target table records, affected by merge command. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
TOutput | Output table record type. |
Remarks
Database support:
MergeWithOutputIntoAsync<TTarget, TSource, TOutput>(IMergeable<TTarget, TSource>, ITable<TOutput>, Expression<Func<String, TTarget, TTarget, TOutput>>, CancellationToken)
Executes merge command, inserts output information into table and returns total number of target records, affected by merge operations.
Declaration
public static Task<int> MergeWithOutputIntoAsync<TTarget, TSource, TOutput>(this IMergeable<TTarget, TSource> merge, ITable<TOutput> outputTable, Expression<Func<string, TTarget, TTarget, TOutput>> outputExpression, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IMergeable<TTarget, TSource> | merge | Merge command definition. |
ITable<TOutput> | outputTable | Table which should handle output result. |
Expression<Func<System.String, TTarget, TTarget, TOutput>> | outputExpression | Output record constructor expression. Optional asynchronous operation cancellation token. Expression supports only record new expression with field initializers. |
CancellationToken | token |
Returns
Type | Description |
---|---|
Task<System.Int32> | Returns number of target table records, affected by merge command. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
TOutput | Output table record type. |
Remarks
Database support:
On<TTarget, TSource>(IMergeableOn<TTarget, TSource>, Expression<Func<TTarget, TSource, Boolean>>)
Adds definition of matching of target and source records using match condition.
Declaration
public static IMergeableSource<TTarget, TSource> On<TTarget, TSource>(this IMergeableOn<TTarget, TSource> merge, Expression<Func<TTarget, TSource, bool>> matchCondition)
Parameters
Type | Name | Description |
---|---|---|
IMergeableOn<TTarget, TSource> | merge | Merge command builder. |
Expression<Func<TTarget, TSource, System.Boolean>> | matchCondition | Rule to match/join target and source records. |
Returns
Type | Description |
---|---|
IMergeableSource<TTarget, TSource> | Returns merge command builder with source, target and match (ON) set. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
On<TTarget, TSource, TKey>(IMergeableOn<TTarget, TSource>, Expression<Func<TTarget, TKey>>, Expression<Func<TSource, TKey>>)
Adds definition of matching of target and source records using key value.
Declaration
public static IMergeableSource<TTarget, TSource> On<TTarget, TSource, TKey>(this IMergeableOn<TTarget, TSource> merge, Expression<Func<TTarget, TKey>> targetKey, Expression<Func<TSource, TKey>> sourceKey)
Parameters
Type | Name | Description |
---|---|---|
IMergeableOn<TTarget, TSource> | merge | Merge command builder. |
Expression<Func<TTarget, TKey>> | targetKey | Target record match key definition. |
Expression<Func<TSource, TKey>> | sourceKey | Source record match key definition. |
Returns
Type | Description |
---|---|
IMergeableSource<TTarget, TSource> | Returns merge command builder with source, target and match (ON) set. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
TKey | Source and target records join/match key type. |
OnTargetKey<TTarget>(IMergeableOn<TTarget, TTarget>)
Adds definition of matching of target and source records using primary key columns.
Declaration
public static IMergeableSource<TTarget, TTarget> OnTargetKey<TTarget>(this IMergeableOn<TTarget, TTarget> merge)
Parameters
Type | Name | Description |
---|---|---|
IMergeableOn<TTarget, TTarget> | merge | Merge command builder. |
Returns
Type | Description |
---|---|
IMergeableSource<TTarget, TTarget> | Returns merge command builder with source, target and match (ON) set. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
Or(TableOptions, TableOptions)
Declaration
public static TableOptions Or(this TableOptions tableOptions, TableOptions additionalOptions)
Parameters
Type | Name | Description |
---|---|---|
TableOptions | tableOptions | |
TableOptions | additionalOptions |
Returns
Type | Description |
---|---|
TableOptions |
QueryHint<TSource>(IQueryable<TSource>, String)
Adds a query hint to a generated query.
Declaration
public static IQueryable<TSource> QueryHint<TSource>(this IQueryable<TSource> source, string hint)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query source with hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
QueryHint<TSource, TParam>(IQueryable<TSource>, String, TParam)
Adds a query hint to the generated query.
Declaration
public static IQueryable<TSource> QueryHint<TSource, TParam>(this IQueryable<TSource> source, string hint, TParam hintParameter)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
TParam | hintParameter | Hint parameter. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query source with hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
TParam | Hint parameter type |
QueryHint<TSource, TParam>(IQueryable<TSource>, String, TParam[])
Adds a query hint to the generated query.
Declaration
public static IQueryable<TSource> QueryHint<TSource, TParam>(this IQueryable<TSource> source, string hint, params TParam[] hintParameters)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
TParam[] | hintParameters | Table hint parameters. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Table-like query source with hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
TParam | Table hint parameter type. |
QueryName<TSource>(IQueryable<TSource>, String)
Defines query name for specified sub-query. The query cannot be removed during the query optimization.
Declaration
public static IQueryable<TSource> QueryName<TSource>(this IQueryable<TSource> source, string queryName)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
System.String | queryName | Query name. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query converted into sub-query. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
QueryName<TKey, TElement>(IQueryable<IGrouping<TKey, TElement>>, String)
Defines query name for specified sub-query. The query cannot be removed during the query optimization.
Declaration
public static IQueryable<TKey> QueryName<TKey, TElement>(this IQueryable<IGrouping<TKey, TElement>> grouping, string queryName)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<IGrouping<TKey, TElement>> | grouping | Source data query. |
System.String | queryName | Query name. |
Returns
Type | Description |
---|---|
IQueryable<TKey> | Query converted into sub-query. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the key of the |
TElement | The type of the values in the |
RemoveOrderBy<TSource>(IQueryable<TSource>)
Removes ordering from current query.
Declaration
public static IQueryable<TSource> RemoveOrderBy<TSource>(this IQueryable<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Unsorted query. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
RightJoin<TSource>(IQueryable<TSource>, Expression<Func<TSource, Boolean>>)
Defines right outer join between two sub-queries or tables.
Declaration
public static IQueryable<TSource> RightJoin<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Right join operand. |
Expression<Func<TSource, System.Boolean>> | predicate | Join predicate. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Right operand. |
Type Parameters
Name | Description |
---|---|
TSource | Type of record for right join operand. |
RightJoin<TOuter, TInner, TResult>(IQueryable<TOuter>, IQueryable<TInner>, Expression<Func<TOuter, TInner, Boolean>>, Expression<Func<TOuter, TInner, TResult>>)
Defines right outer join between two sub-queries or tables.
Declaration
public static IQueryable<TResult> RightJoin<TOuter, TInner, TResult>(this IQueryable<TOuter> outer, IQueryable<TInner> inner, Expression<Func<TOuter, TInner, bool>> predicate, Expression<Func<TOuter, TInner, TResult>> resultSelector)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TOuter> | outer | Left join operand. |
IQueryable<TInner> | inner | Right join operand. |
Expression<Func<TOuter, TInner, System.Boolean>> | predicate | Join predicate. |
Expression<Func<TOuter, TInner, TResult>> | resultSelector | A function to create a result element from two matching elements. |
Returns
Type | Description |
---|---|
IQueryable<TResult> | Right operand. |
Type Parameters
Name | Description |
---|---|
TOuter | Type of record for left join operand. |
TInner | Type of record for right join operand. |
TResult | The type of the result elements. |
SchemaName<T>(ITable<T>, Nullable<String>)
Overrides owner/schema name with new name for current query. This call will have effect only for databases that support owner/schema name in fully-qualified table name.
Supported by: DB2, Oracle, PostgreSQL, Informix, SQL Server, Sybase ASE.
Declaration
public static ITable<T> SchemaName<T>(this ITable<T> table, string? name)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | table | Table-like query source. |
System.Nullable<System.String> | name | Name of owner/schema. |
Returns
Type | Description |
---|---|
ITable<T> | Table-like query source with new owner/schema name. |
Type Parameters
Name | Description |
---|---|
T | Table record mapping class. |
Select<T>(IDataContext, Expression<Func<T>>)
Loads scalar value or record from database without explicit table source. Could be usefull for function calls, querying of database variables or properties, subqueries, execution of code on server side.
Declaration
public static T Select<T>(this IDataContext dataContext, Expression<Func<T>> selector)
Parameters
Type | Name | Description |
---|---|---|
IDataContext | dataContext | Database connection context. |
Expression<Func<T>> | selector | Value selection expression. |
Returns
Type | Description |
---|---|
T | Requested value. |
Type Parameters
Name | Description |
---|---|
T | Type of result. |
SelectAsync<T>(IDataContext, Expression<Func<T>>)
Loads scalar value or record from database without explicit table source asynchronously. Could be usefull for function calls, querying of database variables or properties, subqueries, execution of code on server side.
Declaration
public static async Task<T> SelectAsync<T>(this IDataContext dataContext, Expression<Func<T>> selector)
Parameters
Type | Name | Description |
---|---|---|
IDataContext | dataContext | Database connection context. |
Expression<Func<T>> | selector | Value selection expression. |
Returns
Type | Description |
---|---|
Task<T> | Requested value. |
Type Parameters
Name | Description |
---|---|
T | Type of result. |
ServerName<T>(ITable<T>, Nullable<String>)
Overrides linked server name with new name for current query. This call will have effect only for databases that support linked server name in fully-qualified table name.
Supported by: SQL Server, Informix, Oracle, SAP HANA2.
Declaration
public static ITable<T> ServerName<T>(this ITable<T> table, string? name)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | table | Table-like query source. |
System.Nullable<System.String> | name | Name of linked server. |
Returns
Type | Description |
---|---|
ITable<T> | Table-like query source with new linked server name. |
Type Parameters
Name | Description |
---|---|
T | Table record mapping class. |
Set<T>(IQueryable<T>, Expression<Func<T, String>>)
Adds update field expression to query. It can be any expression with string interpolation.
Declaration
public static IUpdatable<T> Set<T>(this IQueryable<T> source, Expression<Func<T, string>> setExpression)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source query with records to update. |
Expression<Func<T, System.String>> | setExpression | Custom update expression. |
Returns
Type | Description |
---|---|
IUpdatable<T> | IUpdatable<T> query. |
Type Parameters
Name | Description |
---|---|
T | Updated record type. |
Examples
The following example shows how to append string value to appropriate field.
db.Users.Where(u => u.UserId == id)
.Set(u => $"{u.Name}" += {str}")
.Update();
|
Improve this Doc
View Source
Set<T>(IUpdatable<T>, Expression<Func<T, String>>)
Adds update field expression to query. It can be any expression with string interpolation.
Declaration
public static IUpdatable<T> Set<T>(this IUpdatable<T> source, Expression<Func<T, string>> setExpression)
Parameters
Type | Name | Description |
---|---|---|
IUpdatable<T> | source | Source query with records to update. |
Expression<Func<T, System.String>> | setExpression | Custom update expression. |
Returns
Type | Description |
---|---|
IUpdatable<T> | IUpdatable<T> query. |
Type Parameters
Name | Description |
---|---|
T | Updated record type. |
Examples
The following example shows how to append string value to appropriate field.
db.Users.Where(u => u.UserId == id)
.AsUpdatable()
.Set(u => $"{u.Name}" += {str}")
.Update();
|
Improve this Doc
View Source
Set<T, TV>(IQueryable<T>, Expression<Func<T, TV>>, TV)
Adds update field expression to query.
Declaration
public static IUpdatable<T> Set<T, TV>(this IQueryable<T> source, Expression<Func<T, TV>> extract, TV value)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source query with records to update. |
Expression<Func<T, TV>> | extract | Updated field selector expression. |
TV | value | Value, assigned to updated field. |
Returns
Type | Description |
---|---|
IUpdatable<T> | IUpdatable<T> query. |
Type Parameters
Name | Description |
---|---|
T | Updated record type. |
TV | Updated field type. |
Set<T, TV>(IQueryable<T>, Expression<Func<T, TV>>, Expression<Func<T, TV>>)
Adds update field expression to query.
Declaration
public static IUpdatable<T> Set<T, TV>(this IQueryable<T> source, Expression<Func<T, TV>> extract, Expression<Func<T, TV>> update)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source query with records to update. |
Expression<Func<T, TV>> | extract | Updated field selector expression. |
Expression<Func<T, TV>> | update | Updated field setter expression. Uses updated record as parameter. |
Returns
Type | Description |
---|---|
IUpdatable<T> | IUpdatable<T> query. |
Type Parameters
Name | Description |
---|---|
T | Updated record type. |
TV | Updated field type. |
Set<T, TV>(IQueryable<T>, Expression<Func<T, TV>>, Expression<Func<TV>>)
Adds update field expression to query.
Declaration
public static IUpdatable<T> Set<T, TV>(this IQueryable<T> source, Expression<Func<T, TV>> extract, Expression<Func<TV>> update)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source query with records to update. |
Expression<Func<T, TV>> | extract | Updated field selector expression. |
Expression<Func<TV>> | update | Updated field setter expression. |
Returns
Type | Description |
---|---|
IUpdatable<T> | IUpdatable<T> query. |
Type Parameters
Name | Description |
---|---|
T | Updated record type. |
TV | Updated field type. |
Set<T, TV>(IUpdatable<T>, Expression<Func<T, TV>>, TV)
Adds update field expression to query.
Declaration
public static IUpdatable<T> Set<T, TV>(this IUpdatable<T> source, Expression<Func<T, TV>> extract, TV value)
Parameters
Type | Name | Description |
---|---|---|
IUpdatable<T> | source | Source query with records to update. |
Expression<Func<T, TV>> | extract | Updated field selector expression. |
TV | value | Value, assigned to updated field. |
Returns
Type | Description |
---|---|
IUpdatable<T> | IUpdatable<T> query. |
Type Parameters
Name | Description |
---|---|
T | Updated record type. |
TV | Updated field type. |
Set<T, TV>(IUpdatable<T>, Expression<Func<T, TV>>, Expression<Func<T, TV>>)
Adds update field expression to query.
Declaration
public static IUpdatable<T> Set<T, TV>(this IUpdatable<T> source, Expression<Func<T, TV>> extract, Expression<Func<T, TV>> update)
Parameters
Type | Name | Description |
---|---|---|
IUpdatable<T> | source | Source query with records to update. |
Expression<Func<T, TV>> | extract | Updated field selector expression. |
Expression<Func<T, TV>> | update | Updated field setter expression. Uses updated record as parameter. |
Returns
Type | Description |
---|---|
IUpdatable<T> | IUpdatable<T> query. |
Type Parameters
Name | Description |
---|---|
T | Updated record type. |
TV | Updated field type. |
Set<T, TV>(IUpdatable<T>, Expression<Func<T, TV>>, Expression<Func<TV>>)
Adds update field expression to query.
Declaration
public static IUpdatable<T> Set<T, TV>(this IUpdatable<T> source, Expression<Func<T, TV>> extract, Expression<Func<TV>> update)
Parameters
Type | Name | Description |
---|---|---|
IUpdatable<T> | source | Source query with records to update. |
Expression<Func<T, TV>> | extract | Updated field selector expression. |
Expression<Func<TV>> | update | Updated field setter expression. |
Returns
Type | Description |
---|---|
IUpdatable<T> | IUpdatable<T> query. |
Type Parameters
Name | Description |
---|---|
T | Updated record type. |
TV | Updated field type. |
Skip<TSource>(IQueryable<TSource>, Expression<Func<Int32>>)
Ignores first N records from source query.
Declaration
public static IQueryable<TSource> Skip<TSource>(this IQueryable<TSource> source, Expression<Func<int>> count)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query. |
Expression<Func<System.Int32>> | count | Expression that defines number of records to skip. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query without skipped records. |
Type Parameters
Name | Description |
---|---|
TSource | Source table record type. |
SubQueryHint<TSource>(IQueryable<TSource>, String)
Adds a query hint to a generated query.
Declaration
public static IQueryable<TSource> SubQueryHint<TSource>(this IQueryable<TSource> source, string hint)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query source with hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
SubQueryHint<TSource, TParam>(IQueryable<TSource>, String, TParam)
Adds a query hint to the generated query.
Declaration
public static IQueryable<TSource> SubQueryHint<TSource, TParam>(this IQueryable<TSource> source, string hint, TParam hintParameter)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
TParam | hintParameter | Hint parameter. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query source with hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
TParam | Hint parameter type |
SubQueryHint<TSource, TParam>(IQueryable<TSource>, String, TParam[])
Adds a query hint to the generated query.
Declaration
public static IQueryable<TSource> SubQueryHint<TSource, TParam>(this IQueryable<TSource> source, string hint, params TParam[] hintParameters)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
TParam[] | hintParameters | Table hint parameters. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Table-like query source with hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
TParam | Table hint parameter type. |
TableHint<TSource>(ITable<TSource>, String)
Adds a table hint to a table in generated query.
Declaration
public static ITable<TSource> TableHint<TSource>(this ITable<TSource> table, string hint)
Parameters
Type | Name | Description |
---|---|---|
ITable<TSource> | table | Table-like query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
Returns
Type | Description |
---|---|
ITable<TSource> | Table-like query source with table hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
TableHint<TSource, TParam>(ITable<TSource>, String, TParam)
Adds a table hint to a table in generated query.
Declaration
public static ITable<TSource> TableHint<TSource, TParam>(this ITable<TSource> table, string hint, TParam hintParameter)
Parameters
Type | Name | Description |
---|---|---|
ITable<TSource> | table | Table-like query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
TParam | hintParameter | Table hint parameter. |
Returns
Type | Description |
---|---|
ITable<TSource> | Table-like query source with table hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
TParam | Table hint parameter type. |
TableHint<TSource, TParam>(ITable<TSource>, String, TParam[])
Adds a table hint to a table in generated query.
Declaration
public static ITable<TSource> TableHint<TSource, TParam>(this ITable<TSource> table, string hint, params TParam[] hintParameters)
Parameters
Type | Name | Description |
---|---|---|
ITable<TSource> | table | Table-like query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
TParam[] | hintParameters | Table hint parameters. |
Returns
Type | Description |
---|---|
ITable<TSource> | Table-like query source with table hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
TParam | Table hint parameter type. |
TableID<T>(ITable<T>, Nullable<String>)
Assigns table id.
Declaration
public static ITable<T> TableID<T>(this ITable<T> table, string? id)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | table | Table-like query source. |
System.Nullable<System.String> | id | Table ID. |
Returns
Type | Description |
---|---|
ITable<T> | Table-like query source with new name. |
Type Parameters
Name | Description |
---|---|
T | Table record mapping class. |
TableName<T>(ITable<T>, String)
Overrides table or view name with new name for current query.
Declaration
public static ITable<T> TableName<T>(this ITable<T> table, string name)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | table | Table-like query source. |
System.String | name | Name of table. |
Returns
Type | Description |
---|---|
ITable<T> | Table-like query source with new name. |
Type Parameters
Name | Description |
---|---|
T | Table record mapping class. |
TablesInScopeHint<TSource>(IQueryable<TSource>, String)
Adds a table hint to all the tables in the method scope.
Declaration
public static IQueryable<TSource> TablesInScopeHint<TSource>(this IQueryable<TSource> source, string hint)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query source with table hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
TablesInScopeHint<TSource>(IQueryable<TSource>, String, Object[])
Adds a table hint to all the tables in the method scope.
Declaration
public static IQueryable<TSource> TablesInScopeHint<TSource>(this IQueryable<TSource> source, string hint, params object[] hintParameters)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
System.Object[] | hintParameters | Table hint parameters. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query source with table hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
TablesInScopeHint<TSource, TParam>(IQueryable<TSource>, String, TParam)
Adds a table hint to all the tables in the method scope.
Declaration
public static IQueryable<TSource> TablesInScopeHint<TSource, TParam>(this IQueryable<TSource> source, string hint, TParam hintParameter)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
TParam | hintParameter | Table hint parameter. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query source with table hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
TParam | Table hint parameter type. |
TagQuery<TSource>(IQueryable<TSource>, String)
Adds a tag comment before generated query.
The example below will produce following code before generated query: /* my tag */\r\n
db.Table.TagQuery("my tag");
Declaration
public static IQueryable<TSource> TagQuery<TSource>(this IQueryable<TSource> source, string tagValue)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
System.String | tagValue | Tag text to be added as comment before generated query. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query with tag. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
TagQuery<T>(ITable<T>, String)
Adds a tag comment before generated query for table.
The example below will produce following code before generated query: /* my tag */\r\n
db.Table.TagQuery("my tag");
Declaration
public static ITable<T> TagQuery<T>(this ITable<T> table, string tagValue)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | table | Table-like query source. |
System.String | tagValue | Tag text to be added as comment before generated query. |
Returns
Type | Description |
---|---|
ITable<T> | Table-like query source with tag. |
Type Parameters
Name | Description |
---|---|
T | Table record mapping class. |
Take<TSource>(IQueryable<TSource>, Expression<Func<Int32>>)
Limits number of records, returned from query.
Declaration
public static IQueryable<TSource> Take<TSource>(this IQueryable<TSource> source, Expression<Func<int>> count)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query. |
Expression<Func<System.Int32>> | count | Expression that defines number of records to select. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query with limit applied. |
Type Parameters
Name | Description |
---|---|
TSource | Source table record type. |
Take<TSource>(IQueryable<TSource>, Expression<Func<Int32>>, TakeHints)
Limits number of records, returned from query. Allows to specify TAKE clause hints. Using this method may cause runtime LinqException if take hints are not supported by database.
Declaration
public static IQueryable<TSource> Take<TSource>(this IQueryable<TSource> source, Expression<Func<int>> count, TakeHints hints)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query. |
Expression<Func<System.Int32>> | count | Expression that defines SQL TAKE parameter value. |
TakeHints | hints | TakeHints hints for SQL TAKE clause. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query with limit applied. |
Type Parameters
Name | Description |
---|---|
TSource | Source table record type. |
Take<TSource>(IQueryable<TSource>, Int32, TakeHints)
Limits number of records, returned from query. Allows to specify TAKE clause hints. Using this method may cause runtime LinqException if take hints are not supported by database.
Declaration
public static IQueryable<TSource> Take<TSource>(this IQueryable<TSource> source, int count, TakeHints hints)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query. |
System.Int32 | count | SQL TAKE parameter value. |
TakeHints | hints | TakeHints hints for SQL TAKE clause. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | Query with limit applied. |
Type Parameters
Name | Description |
---|---|
TSource | Source table record type. |
ThenLoad<TEntity, TPreviousProperty, TProperty>(ILoadWithQueryable<TEntity, TPreviousProperty>, Expression<Func<TPreviousProperty, TProperty>>)
Specifies associations that should be loaded for parent association, loaded by previous LoadWith/ThenLoad call in chain.
All associations, specified in selector
expression, will be loaded.
Take into account that use of this method could require multiple queries to load all requested associations.
Declaration
public static ILoadWithQueryable<TEntity, TProperty> ThenLoad<TEntity, TPreviousProperty, TProperty>(this ILoadWithQueryable<TEntity, TPreviousProperty> source, Expression<Func<TPreviousProperty, TProperty>> selector)
where TEntity : class
Parameters
Type | Name | Description |
---|---|---|
ILoadWithQueryable<TEntity, TPreviousProperty> | source | The source query. |
Expression<Func<TPreviousProperty, TProperty>> | selector | A lambda expression representing navigation property to be included ( |
Returns
Type | Description |
---|---|
ILoadWithQueryable<TEntity, TProperty> | Returns new query with related data included. |
Type Parameters
Name | Description |
---|---|
TEntity | Type of entity being queried. |
TPreviousProperty | Type of parent association. |
TProperty | Type of the related entity to be included. |
Examples
Following queries loads records from Table1 with Reference1 association and then loads records from Reference2 association for each loaded Reference1 record.
db.Table1.LoadWith(r => r.Reference1.Reference2);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.Reference1).ThenLoad(r => r.Reference2);
Note that a way you access collection association record (by index, using First() method) doesn't affect query results and always select all records.
db.Table1.LoadWith(r => r.References1[0].References2.First().Reference3);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.References1).ThenLoad(r => r.References2).ThenLoad(r => r.Reference3);
|
Improve this Doc
View Source
ThenLoad<TEntity, TPreviousProperty, TProperty>(ILoadWithQueryable<TEntity, TPreviousProperty>, Expression<Func<TPreviousProperty, TProperty>>, Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>>)
Specifies associations that should be loaded for parent association, loaded by previous LoadWith/ThenLoad call in chain.
All associations, specified in selector
expression, will be loaded.
Take into account that use of this method could require multiple queries to load all requested associations.
loadFunc
parameter could be used to define additional association loading logic like filters or loading of more associations.
Declaration
public static ILoadWithQueryable<TEntity, TProperty> ThenLoad<TEntity, TPreviousProperty, TProperty>(this ILoadWithQueryable<TEntity, TPreviousProperty> source, Expression<Func<TPreviousProperty, TProperty>> selector, Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>> loadFunc)
where TEntity : class
Parameters
Type | Name | Description |
---|---|---|
ILoadWithQueryable<TEntity, TPreviousProperty> | source | The source query. |
Expression<Func<TPreviousProperty, TProperty>> | selector | A lambda expression representing navigation property to be included ( |
Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>> | loadFunc | Defines additional logic for association load query. |
Returns
Type | Description |
---|---|
ILoadWithQueryable<TEntity, TProperty> | Returns new query with related data included. |
Type Parameters
Name | Description |
---|---|
TEntity | Type of entity being queried. |
TPreviousProperty | Type of parent association. |
TProperty | Type of the related entity to be included. |
Examples
Following queries loads records from Table1 with Reference1 association and then loads records from Reference2 association for each loaded Reference1 record.
db.Table1.LoadWith(r => r.Reference1.Reference2);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.Reference1).ThenLoad(r => r.Reference2);
Note that a way you access collection association record (by index, using First() method) doesn't affect query results and always select all records.
db.Table1.LoadWith(r => r.References1[0].References2.First().Reference3);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.References1).ThenLoad(r => r.References2).ThenLoad(r => r.Reference3);
Following query loads records from Table1 with References1 collection association loaded for each Table1 record with References2 collection association loaded for each record in References1, with filter over References2 record to include only records without "exclude" text in Name property.
db.Table1.LoadWith(r => r.References1).ThenLoad(r1 => r1.References2, r2 => r2.Where(rr2 => !rr2.Name.Contains("exclude")));
|
Improve this Doc
View Source
ThenLoad<TEntity, TPreviousProperty, TProperty>(ILoadWithQueryable<TEntity, TPreviousProperty>, Expression<Func<TPreviousProperty, IEnumerable<TProperty>>>, Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>>)
Specifies associations that should be loaded for parent association, loaded by previous LoadWith/ThenLoad call in chain.
All associations, specified in selector
expression, will be loaded.
Take into account that use of this method could require multiple queries to load all requested associations.
loadFunc
parameter could be used to define additional association loading logic like filters or loading of more associations.
Declaration
public static ILoadWithQueryable<TEntity, TProperty> ThenLoad<TEntity, TPreviousProperty, TProperty>(this ILoadWithQueryable<TEntity, TPreviousProperty> source, Expression<Func<TPreviousProperty, IEnumerable<TProperty>>> selector, Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>> loadFunc)
where TEntity : class
Parameters
Type | Name | Description |
---|---|---|
ILoadWithQueryable<TEntity, TPreviousProperty> | source | The source query. |
Expression<Func<TPreviousProperty, IEnumerable<TProperty>>> | selector | A lambda expression representing navigation property to be included ( |
Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>> | loadFunc | Defines additional logic for association load query. |
Returns
Type | Description |
---|---|
ILoadWithQueryable<TEntity, TProperty> | Returns new query with related data included. |
Type Parameters
Name | Description |
---|---|
TEntity | Type of entity being queried. |
TPreviousProperty | Type of parent association. |
TProperty | Type of the related entity to be included. |
Examples
Following queries loads records from Table1 with Reference1 association and then loads records from Reference2 association for each loaded Reference1 record.
db.Table1.LoadWith(r => r.Reference1.Reference2);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.Reference1).ThenLoad(r => r.Reference2);
Note that a way you access collection association record (by index, using First() method) doesn't affect query results and always select all records.
db.Table1.LoadWith(r => r.References1[0].References2.First().Reference3);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.References1).ThenLoad(r => r.References2).ThenLoad(r => r.Reference3);
Following query loads records from Table1 with References1 collection association loaded for each Table1 record with References2 collection association loaded for each record in References1, with filter over References2 record to include only records without "exclude" text in Name property.
db.Table1.LoadWith(r => r.References1).ThenLoad(r1 => r1.References2, r2 => r2.Where(rr2 => !rr2.Name.Contains("exclude")));
|
Improve this Doc
View Source
ThenLoad<TEntity, TPreviousProperty, TProperty>(ILoadWithQueryable<TEntity, IEnumerable<TPreviousProperty>>, Expression<Func<TPreviousProperty, TProperty>>)
Specifies associations that should be loaded for parent association, loaded by previous LoadWith/ThenLoad call in chain.
All associations, specified in selector
expression, will be loaded.
Take into account that use of this method could require multiple queries to load all requested associations.
Declaration
public static ILoadWithQueryable<TEntity, TProperty> ThenLoad<TEntity, TPreviousProperty, TProperty>(this ILoadWithQueryable<TEntity, IEnumerable<TPreviousProperty>> source, Expression<Func<TPreviousProperty, TProperty>> selector)
where TEntity : class
Parameters
Type | Name | Description |
---|---|---|
ILoadWithQueryable<TEntity, IEnumerable<TPreviousProperty>> | source | The source query. |
Expression<Func<TPreviousProperty, TProperty>> | selector | A lambda expression representing navigation property to be included ( |
Returns
Type | Description |
---|---|
ILoadWithQueryable<TEntity, TProperty> | Returns new query with related data included. |
Type Parameters
Name | Description |
---|---|
TEntity | Type of entity being queried. |
TPreviousProperty | Type of parent association. |
TProperty | Type of the related entity to be included. |
Examples
Following queries loads records from Table1 with Reference1 association and then loads records from Reference2 association for each loaded Reference1 record.
db.Table1.LoadWith(r => r.Reference1.Reference2);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.Reference1).ThenLoad(r => r.Reference2);
Note that a way you access collection association record (by index, using First() method) doesn't affect query results and always select all records.
db.Table1.LoadWith(r => r.References1[0].References2.First().Reference3);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.References1).ThenLoad(r => r.References2).ThenLoad(r => r.Reference3);
|
Improve this Doc
View Source
ThenLoad<TEntity, TPreviousProperty, TProperty>(ILoadWithQueryable<TEntity, IEnumerable<TPreviousProperty>>, Expression<Func<TPreviousProperty, TProperty>>, Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>>)
Specifies associations that should be loaded for parent association, loaded by previous LoadWith/ThenLoad call in chain.
All associations, specified in selector
expression, will be loaded.
Take into account that use of this method could require multiple queries to load all requested associations.
loadFunc
parameter could be used to define additional association loading logic like filters or loading of more associations.
Declaration
public static ILoadWithQueryable<TEntity, TProperty> ThenLoad<TEntity, TPreviousProperty, TProperty>(this ILoadWithQueryable<TEntity, IEnumerable<TPreviousProperty>> source, Expression<Func<TPreviousProperty, TProperty>> selector, Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>> loadFunc)
where TEntity : class
Parameters
Type | Name | Description |
---|---|---|
ILoadWithQueryable<TEntity, IEnumerable<TPreviousProperty>> | source | The source query. |
Expression<Func<TPreviousProperty, TProperty>> | selector | A lambda expression representing navigation property to be included ( |
Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>> | loadFunc | Defines additional logic for association load query. |
Returns
Type | Description |
---|---|
ILoadWithQueryable<TEntity, TProperty> | Returns new query with related data included. |
Type Parameters
Name | Description |
---|---|
TEntity | Type of entity being queried. |
TPreviousProperty | Type of parent association. |
TProperty | Type of the related entity to be included. |
Examples
Following queries loads records from Table1 with Reference1 association and then loads records from Reference2 association for each loaded Reference1 record.
db.Table1.LoadWith(r => r.Reference1.Reference2);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.Reference1).ThenLoad(r => r.Reference2);
Note that a way you access collection association record (by index, using First() method) doesn't affect query results and always select all records.
db.Table1.LoadWith(r => r.References1[0].References2.First().Reference3);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.References1).ThenLoad(r => r.References2).ThenLoad(r => r.Reference3);
Following query loads records from Table1 with References1 collection association loaded for each Table1 record with References2 collection association loaded for each record in References1, with filter over References2 record to include only records without "exclude" text in Name property.
db.Table1.LoadWith(r => r.References1).ThenLoad(r1 => r1.References2, r2 => r2.Where(rr2 => !rr2.Name.Contains("exclude")));
|
Improve this Doc
View Source
ThenLoad<TEntity, TPreviousProperty, TProperty>(ILoadWithQueryable<TEntity, IEnumerable<TPreviousProperty>>, Expression<Func<TPreviousProperty, IEnumerable<TProperty>>>, Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>>)
Specifies associations that should be loaded for parent association, loaded by previous LoadWith/ThenLoad call in chain.
All associations, specified in selector
expression, will be loaded.
Take into account that use of this method could require multiple queries to load all requested associations.
loadFunc
parameter could be used to define additional association loading logic like filters or loading of more associations.
Declaration
public static ILoadWithQueryable<TEntity, TProperty> ThenLoad<TEntity, TPreviousProperty, TProperty>(this ILoadWithQueryable<TEntity, IEnumerable<TPreviousProperty>> source, Expression<Func<TPreviousProperty, IEnumerable<TProperty>>> selector, Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>> loadFunc)
where TEntity : class
Parameters
Type | Name | Description |
---|---|---|
ILoadWithQueryable<TEntity, IEnumerable<TPreviousProperty>> | source | The source query. |
Expression<Func<TPreviousProperty, IEnumerable<TProperty>>> | selector | A lambda expression representing navigation property to be included ( |
Expression<Func<IQueryable<TProperty>, IQueryable<TProperty>>> | loadFunc | Defines additional logic for association load query. |
Returns
Type | Description |
---|---|
ILoadWithQueryable<TEntity, TProperty> | Returns new query with related data included. |
Type Parameters
Name | Description |
---|---|
TEntity | Type of entity being queried. |
TPreviousProperty | Type of parent association. |
TProperty | Type of the related entity to be included. |
Examples
Following queries loads records from Table1 with Reference1 association and then loads records from Reference2 association for each loaded Reference1 record.
db.Table1.LoadWith(r => r.Reference1.Reference2);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.Reference1).ThenLoad(r => r.Reference2);
Note that a way you access collection association record (by index, using First() method) doesn't affect query results and always select all records.
db.Table1.LoadWith(r => r.References1[0].References2.First().Reference3);
Same query using ThenLoad extension.
db.Table1.LoadWith(r => r.References1).ThenLoad(r => r.References2).ThenLoad(r => r.Reference3);
Following query loads records from Table1 with References1 collection association loaded for each Table1 record with References2 collection association loaded for each record in References1, with filter over References2 record to include only records without "exclude" text in Name property.
db.Table1.LoadWith(r => r.References1).ThenLoad(r1 => r1.References2, r2 => r2.Where(rr2 => !rr2.Name.Contains("exclude")));
|
Improve this Doc
View Source
ThenOrBy<TSource, TKey>(IQueryable<TSource>, Expression<Func<TSource, TKey>>)
Adds ascending sort expression to a query. If query already sorted, existing sorting will be preserved and updated with new sort.
Declaration
public static IOrderedQueryable<TSource> ThenOrBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query. |
Expression<Func<TSource, TKey>> | keySelector | Sort expression selector. |
Returns
Type | Description |
---|---|
IOrderedQueryable<TSource> | Sorted query. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TKey | Sort expression type. |
ThenOrByDescending<TSource, TKey>(IQueryable<TSource>, Expression<Func<TSource, TKey>>)
Adds descending sort expression to a query. If query already sorted, existing sorting will be preserved and updated with new sort.
Declaration
public static IOrderedQueryable<TSource> ThenOrByDescending<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source query. |
Expression<Func<TSource, TKey>> | keySelector | Sort expression selector. |
Returns
Type | Description |
---|---|
IOrderedQueryable<TSource> | Sorted query. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TKey | Sort expression type. |
Truncate<T>(ITable<T>, Boolean)
Truncates database table.
Declaration
public static int Truncate<T>(this ITable<T> target, bool resetIdentity = true)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Truncated table. |
System.Boolean | resetIdentity | Performs reset identity column. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. Usually |
Type Parameters
Name | Description |
---|---|
T | Table record type. |
TruncateAsync<T>(ITable<T>, Boolean, CancellationToken)
Truncates database table asynchronously.
Declaration
public static async Task<int> TruncateAsync<T>(this ITable<T> target, bool resetIdentity = true, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | target | Truncated table. |
System.Boolean | resetIdentity | Performs reset identity column. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. Usually |
Type Parameters
Name | Description |
---|---|
T | Table record type. |
UnionAll<TSource>(IQueryable<TSource>, IEnumerable<TSource>)
Concatenates two sequences, similar to
Declaration
public static IQueryable<TSource> UnionAll<TSource>(this IQueryable<TSource> source1, IEnumerable<TSource> source2)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source1 | The first sequence to concatenate. |
IEnumerable<TSource> | source2 | The sequence to concatenate to the first sequence. |
Returns
Type | Description |
---|---|
IQueryable<TSource> | An |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the input sequences. |
Update<T>(IQueryable<T>, Expression<Func<T, T>>)
Executes update operation using source query as record filter.
Declaration
public static int Update<T>(this IQueryable<T> source, Expression<Func<T, T>> setter)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source data query. |
Expression<Func<T, T>> | setter | Update expression. Uses updated record as parameter. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Int32 | Number of updated records. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
Update<T>(IQueryable<T>, Expression<Func<T, Boolean>>, Expression<Func<T, T>>)
Executes update operation using source query as record filter with additional filter expression.
Declaration
public static int Update<T>(this IQueryable<T> source, Expression<Func<T, bool>> predicate, Expression<Func<T, T>> setter)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source data query. |
Expression<Func<T, System.Boolean>> | predicate | Filter expression, to specify what records from source query should be updated. |
Expression<Func<T, T>> | setter | Update expression. Uses updated record as parameter. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Int32 | Number of updated records. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
Update<T>(IUpdatable<T>)
Executes update operation for already configured update query.
Declaration
public static int Update<T>(this IUpdatable<T> source)
Parameters
Type | Name | Description |
---|---|---|
IUpdatable<T> | source | Update query. |
Returns
Type | Description |
---|---|
System.Int32 | Number of updated records. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
Update<TSource, TTarget>(IQueryable<TSource>, Expression<Func<TSource, TTarget>>, Expression<Func<TSource, TTarget>>)
Executes update-from-source operation against target table. Also see Update<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>) method.
Declaration
public static int Update<TSource, TTarget>(this IQueryable<TSource> source, Expression<Func<TSource, TTarget>> target, Expression<Func<TSource, TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
Expression<Func<TSource, TTarget>> | target | Target table selection expression. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Int32 | Number of updated records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
Update<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>)
Executes update-from-source operation against target table.
Declaration
public static int Update<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
System.Int32 | Number of updated records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
UpdateAsync<T>(IQueryable<T>, Expression<Func<T, T>>, CancellationToken)
Executes update operation asynchronously using source query as record filter.
Declaration
public static async Task<int> UpdateAsync<T>(this IQueryable<T> source, Expression<Func<T, T>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source data query. |
Expression<Func<T, T>> | setter | Update expression. Uses updated record as parameter. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of updated records. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
UpdateAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, Expression<Func<T, T>>, CancellationToken)
Executes update operation asynchronously using source query as record filter with additional filter expression.
Declaration
public static async Task<int> UpdateAsync<T>(this IQueryable<T> source, Expression<Func<T, bool>> predicate, Expression<Func<T, T>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source data query. |
Expression<Func<T, System.Boolean>> | predicate | Filter expression, to specify what records from source query should be updated. |
Expression<Func<T, T>> | setter | Update expression. Uses updated record as parameter. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of updated records. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
UpdateAsync<T>(IUpdatable<T>, CancellationToken)
Executes update operation asynchronously for already configured update query.
Declaration
public static async Task<int> UpdateAsync<T>(this IUpdatable<T> source, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IUpdatable<T> | source | Update query. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of updated records. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
UpdateAsync<TSource, TTarget>(IQueryable<TSource>, Expression<Func<TSource, TTarget>>, Expression<Func<TSource, TTarget>>, CancellationToken)
Executes update-from-source operation asynchronously against target table. Also see UpdateAsync<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, CancellationToken) method.
Declaration
public static async Task<int> UpdateAsync<TSource, TTarget>(this IQueryable<TSource> source, Expression<Func<TSource, TTarget>> target, Expression<Func<TSource, TTarget>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
Expression<Func<TSource, TTarget>> | target | Target table selection expression. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of updated records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
UpdateAsync<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, CancellationToken)
Executes update-from-source operation asynchronously against target table.
Declaration
public static async Task<int> UpdateAsync<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of updated records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
UpdateWhenMatched<TTarget>(IMergeableSource<TTarget, TTarget>)
Adds new update operation to merge and returns new merge command with added operation. This operation updates record in target table using data from the same fields of source record for each record that was matched in source and target, if it wasn't processed by previous operations.
Declaration
public static IMergeable<TTarget, TTarget> UpdateWhenMatched<TTarget>(this IMergeableSource<TTarget, TTarget> merge)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TTarget> | merge | Merge command builder interface. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TTarget> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target and source records type. |
UpdateWhenMatched<TTarget, TSource>(IMergeableSource<TTarget, TSource>, Expression<Func<TTarget, TSource, TTarget>>)
Adds new update operation to merge and returns new merge command with added operation. This operation updates record in target table using user-defined values for target columns for each record that was matched in source and target, if it wasn't processed by previous operations.
Declaration
public static IMergeable<TTarget, TSource> UpdateWhenMatched<TTarget, TSource>(this IMergeableSource<TTarget, TSource> merge, Expression<Func<TTarget, TSource, TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TSource> | merge | Merge command builder interface. |
Expression<Func<TTarget, TSource, TTarget>> | setter | Update record expression using target and source records. Expression should be a call to target record constructor with field/properties initializers to be recognized by API. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TSource> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
UpdateWhenMatchedAnd<TTarget>(IMergeableSource<TTarget, TTarget>, Expression<Func<TTarget, TTarget, Boolean>>)
Adds new update operation to merge and returns new merge command with added operation. This operation updates record in target table using data from the same fields of source record for each record that was matched in source and target and passes filtering with specified predicate, if it wasn't processed by previous operations.
Declaration
public static IMergeable<TTarget, TTarget> UpdateWhenMatchedAnd<TTarget>(this IMergeableSource<TTarget, TTarget> merge, Expression<Func<TTarget, TTarget, bool>> searchCondition)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TTarget> | merge | Merge command builder interface. |
Expression<Func<TTarget, TTarget, System.Boolean>> | searchCondition | Operation execution condition over target and source records. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TTarget> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target and source records type. |
UpdateWhenMatchedAnd<TTarget, TSource>(IMergeableSource<TTarget, TSource>, Expression<Func<TTarget, TSource, Boolean>>, Expression<Func<TTarget, TSource, TTarget>>)
Adds new update operation to merge and returns new merge command with added operation. This operation updates record in target table using user-defined values for target columns for each record that was matched in source and target and passes filtering with specified predicate, if it wasn't processed by previous operations.
Declaration
public static IMergeable<TTarget, TSource> UpdateWhenMatchedAnd<TTarget, TSource>(this IMergeableSource<TTarget, TSource> merge, Expression<Func<TTarget, TSource, bool>> searchCondition, Expression<Func<TTarget, TSource, TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TSource> | merge | Merge command builder interface. |
Expression<Func<TTarget, TSource, System.Boolean>> | searchCondition | Operation execution condition over target and source records. |
Expression<Func<TTarget, TSource, TTarget>> | setter | Update record expression using target and source records. Expression should be a call to target record constructor with field/properties initializers to be recognized by API. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TSource> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
UpdateWhenMatchedAndThenDelete<TTarget>(IMergeableSource<TTarget, TTarget>, Expression<Func<TTarget, TTarget, Boolean>>, Expression<Func<TTarget, TTarget, Boolean>>)
IMPORTANT: This operation supported only by Oracle Database. Adds new update with delete operation to merge and returns new merge command with added operation. This operation updates record in target table using data from the same fields of source record for each record that was matched in source and target and passes filtering with specified predicate, if it wasn't processed by previous operations. After that it removes updated records if they are matched by delete predicate.
Declaration
public static IMergeable<TTarget, TTarget> UpdateWhenMatchedAndThenDelete<TTarget>(this IMergeableSource<TTarget, TTarget> merge, Expression<Func<TTarget, TTarget, bool>> searchCondition, Expression<Func<TTarget, TTarget, bool>> deleteCondition)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TTarget> | merge | Merge command builder interface. |
Expression<Func<TTarget, TTarget, System.Boolean>> | searchCondition | Update execution condition over target and source records. |
Expression<Func<TTarget, TTarget, System.Boolean>> | deleteCondition | Delete execution condition over updated target and source records. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TTarget> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target and source records type. |
UpdateWhenMatchedAndThenDelete<TTarget, TSource>(IMergeableSource<TTarget, TSource>, Expression<Func<TTarget, TSource, Boolean>>, Expression<Func<TTarget, TSource, TTarget>>, Expression<Func<TTarget, TSource, Boolean>>)
IMPORTANT: This operation supported only by Oracle Database. Adds new update with delete operation to merge and returns new merge command with added operation. This operation updates record in target table using user-defined values for target columns for each record that was matched in source and target and passes filtering with specified predicate, if it wasn't processed by previous operations. After that it removes updated records if they matched by delete predicate.
Declaration
public static IMergeable<TTarget, TSource> UpdateWhenMatchedAndThenDelete<TTarget, TSource>(this IMergeableSource<TTarget, TSource> merge, Expression<Func<TTarget, TSource, bool>> searchCondition, Expression<Func<TTarget, TSource, TTarget>> setter, Expression<Func<TTarget, TSource, bool>> deleteCondition)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TSource> | merge | Merge command builder interface. |
Expression<Func<TTarget, TSource, System.Boolean>> | searchCondition | Update execution condition over target and source records. |
Expression<Func<TTarget, TSource, TTarget>> | setter | Update record expression using target and source records. Expression should be a call to target record constructor with field/properties initializers to be recognized by API. |
Expression<Func<TTarget, TSource, System.Boolean>> | deleteCondition | Delete execution condition over updated target and source records. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TSource> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
UpdateWhenMatchedThenDelete<TTarget>(IMergeableSource<TTarget, TTarget>, Expression<Func<TTarget, TTarget, Boolean>>)
IMPORTANT: This operation supported only by Oracle Database. Adds new update with delete operation to merge and returns new merge command with added operation. This operation updates record in target table using data from the same fields of source record for each record that was matched in source and target, if it wasn't processed by previous operations. After that it removes updated records if they are matched by delete predicate.
Declaration
public static IMergeable<TTarget, TTarget> UpdateWhenMatchedThenDelete<TTarget>(this IMergeableSource<TTarget, TTarget> merge, Expression<Func<TTarget, TTarget, bool>> deleteCondition)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TTarget> | merge | Merge command builder interface. |
Expression<Func<TTarget, TTarget, System.Boolean>> | deleteCondition | Delete execution condition over updated target and source records. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TTarget> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target and source records type. |
UpdateWhenMatchedThenDelete<TTarget, TSource>(IMergeableSource<TTarget, TSource>, Expression<Func<TTarget, TSource, TTarget>>, Expression<Func<TTarget, TSource, Boolean>>)
IMPORTANT: This operation supported only by Oracle Database. Adds new update with delete operation to merge and returns new merge command with added operation. This operation updates record in target table using user-defined values for target columns for each record that was matched in source and target, if it wasn't processed by previous operations. After that it removes updated records if they matched by delete predicate.
Declaration
public static IMergeable<TTarget, TSource> UpdateWhenMatchedThenDelete<TTarget, TSource>(this IMergeableSource<TTarget, TSource> merge, Expression<Func<TTarget, TSource, TTarget>> setter, Expression<Func<TTarget, TSource, bool>> deleteCondition)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TSource> | merge | Merge command builder interface. |
Expression<Func<TTarget, TSource, TTarget>> | setter | Update record expression using target and source records. Expression should be a call to target record constructor with field/properties initializers to be recognized by API. |
Expression<Func<TTarget, TSource, System.Boolean>> | deleteCondition | Delete execution condition over updated target and source records. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TSource> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
UpdateWhenNotMatchedBySource<TTarget, TSource>(IMergeableSource<TTarget, TSource>, Expression<Func<TTarget, TTarget>>)
IMPORTANT: This operation supported only by Microsoft SQL Server. Adds new update by source operation to merge and returns new merge command with added operation. This operation updates record in target table for each record that was matched only in target using user-defined values for target columns, if it wasn't processed by previous operations.
Declaration
public static IMergeable<TTarget, TSource> UpdateWhenNotMatchedBySource<TTarget, TSource>(this IMergeableSource<TTarget, TSource> merge, Expression<Func<TTarget, TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TSource> | merge | Merge command builder interface. |
Expression<Func<TTarget, TTarget>> | setter | Update record expression using target record. Expression should be a call to target record constructor with field/properties initializers to be recognized by API. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TSource> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
UpdateWhenNotMatchedBySourceAnd<TTarget, TSource>(IMergeableSource<TTarget, TSource>, Expression<Func<TTarget, Boolean>>, Expression<Func<TTarget, TTarget>>)
IMPORTANT: This operation supported only by Microsoft SQL Server. Adds new update by source operation to merge and returns new merge command with added operation. This operation updates record in target table for each record that was matched only in target using user-defined values for target columns, if it passed filtering by operation predicate and wasn't processed by previous operations.
Declaration
public static IMergeable<TTarget, TSource> UpdateWhenNotMatchedBySourceAnd<TTarget, TSource>(this IMergeableSource<TTarget, TSource> merge, Expression<Func<TTarget, bool>> searchCondition, Expression<Func<TTarget, TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
IMergeableSource<TTarget, TSource> | merge | Merge command builder interface. |
Expression<Func<TTarget, System.Boolean>> | searchCondition | Operation execution condition over target record. |
Expression<Func<TTarget, TTarget>> | setter | Update record expression using target record. Expression should be a call to target record constructor with field/properties initializers to be recognized by API. |
Returns
Type | Description |
---|---|
IMergeable<TTarget, TSource> | Returns new merge command builder with new operation. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
UpdateWithOutput<T>(IQueryable<T>, Expression<Func<T, T>>)
Executes update operation using source query as record filter.
Declaration
public static IEnumerable<UpdateOutput<T>> UpdateWithOutput<T>(this IQueryable<T> source, Expression<Func<T, T>> setter)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source data query. |
Expression<Func<T, T>> | setter | Update expression. Uses updated record as parameter. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
IEnumerable<UpdateOutput<T>> | Deleted and inserted values for every record updated. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
Remarks
Database support:
UpdateWithOutput<T>(IUpdatable<T>)
Executes update operation using source query as record filter.
Declaration
public static IEnumerable<UpdateOutput<T>> UpdateWithOutput<T>(this IUpdatable<T> source)
Parameters
Type | Name | Description |
---|---|---|
IUpdatable<T> | source | Source data query. |
Returns
Type | Description |
---|---|
IEnumerable<UpdateOutput<T>> | Deleted and inserted values for every record updated. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
Remarks
Database support:
UpdateWithOutput<T, TOutput>(IQueryable<T>, Expression<Func<T, T>>, Expression<Func<T, T, TOutput>>)
Executes update operation using source query as record filter.
Declaration
public static IEnumerable<TOutput> UpdateWithOutput<T, TOutput>(this IQueryable<T> source, Expression<Func<T, T>> setter, Expression<Func<T, T, TOutput>> outputExpression)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source data query. |
Expression<Func<T, T>> | setter | Update expression. Uses updated record as parameter. Expression supports only target table record new expression with field initializers. |
Expression<Func<T, T, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
Returns
Type | Description |
---|---|
IEnumerable<TOutput> | Output values from the update statement. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
TOutput | Output table record type. |
Remarks
Database support:
UpdateWithOutput<TSource, TTarget>(IQueryable<TSource>, Expression<Func<TSource, TTarget>>, Expression<Func<TSource, TTarget>>)
Executes update-from-source operation against target table.
Declaration
public static IEnumerable<UpdateOutput<TTarget>> UpdateWithOutput<TSource, TTarget>(this IQueryable<TSource> source, Expression<Func<TSource, TTarget>> target, Expression<Func<TSource, TTarget>> setter)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
Expression<Func<TSource, TTarget>> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
IEnumerable<UpdateOutput<TTarget>> | Deleted and inserted values for every record updated. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
Remarks
Database support:
UpdateWithOutput<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>)
Executes update-from-source operation against target table.
Declaration
public static IEnumerable<UpdateOutput<TTarget>> UpdateWithOutput<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter)
where TTarget : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
Returns
Type | Description |
---|---|
IEnumerable<UpdateOutput<TTarget>> | Deleted and inserted values for every record updated. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
Remarks
Database support:
UpdateWithOutput<T, TOutput>(IUpdatable<T>, Expression<Func<T, T, TOutput>>)
Executes update operation using source query as record filter.
Declaration
public static IEnumerable<TOutput> UpdateWithOutput<T, TOutput>(this IUpdatable<T> source, Expression<Func<T, T, TOutput>> outputExpression)
Parameters
Type | Name | Description |
---|---|---|
IUpdatable<T> | source | Source data query. |
Expression<Func<T, T, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
Returns
Type | Description |
---|---|
IEnumerable<TOutput> | Output values from the update statement. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
TOutput | Output table record type. |
Remarks
Database support:
UpdateWithOutput<TSource, TTarget, TOutput>(IQueryable<TSource>, Expression<Func<TSource, TTarget>>, Expression<Func<TSource, TTarget>>, Expression<Func<TSource, TTarget, TTarget, TOutput>>)
Executes update-from-source operation against target table.
Declaration
public static IEnumerable<TOutput> UpdateWithOutput<TSource, TTarget, TOutput>(this IQueryable<TSource> source, Expression<Func<TSource, TTarget>> target, Expression<Func<TSource, TTarget>> setter, Expression<Func<TSource, TTarget, TTarget, TOutput>> outputExpression)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
Expression<Func<TSource, TTarget>> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
Expression<Func<TSource, TTarget, TTarget, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
Returns
Type | Description |
---|---|
IEnumerable<TOutput> | Output values from the update statement. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
TOutput | Output table record type. |
Remarks
Database support:
UpdateWithOutput<TSource, TTarget, TOutput>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, Expression<Func<TSource, TTarget, TTarget, TOutput>>)
Executes update-from-source operation against target table.
Declaration
public static IEnumerable<TOutput> UpdateWithOutput<TSource, TTarget, TOutput>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, Expression<Func<TSource, TTarget, TTarget, TOutput>> outputExpression)
where TTarget : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
Expression<Func<TSource, TTarget, TTarget, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
Returns
Type | Description |
---|---|
IEnumerable<TOutput> | Output values from the update statement. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
TOutput | Output table record type. |
Remarks
Database support:
UpdateWithOutputAsync<T>(IQueryable<T>, Expression<Func<T, T>>, CancellationToken)
Executes update operation using source query as record filter.
Declaration
public static Task<UpdateOutput<T>[]> UpdateWithOutputAsync<T>(this IQueryable<T> source, Expression<Func<T, T>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source data query. |
Expression<Func<T, T>> | setter | Update expression. Uses updated record as parameter. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<UpdateOutput<T>[]> | Deleted and inserted values for every record updated. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
Remarks
Database support:
UpdateWithOutputAsync<T>(IUpdatable<T>, CancellationToken)
Executes update operation using source query as record filter.
Declaration
public static Task<UpdateOutput<T>[]> UpdateWithOutputAsync<T>(this IUpdatable<T> source, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IUpdatable<T> | source | Source data query. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<UpdateOutput<T>[]> | Deleted and inserted values for every record updated. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
Remarks
Database support:
UpdateWithOutputAsync<T, TOutput>(IQueryable<T>, Expression<Func<T, T>>, Expression<Func<T, T, TOutput>>, CancellationToken)
Executes update operation using source query as record filter.
Declaration
public static Task<TOutput[]> UpdateWithOutputAsync<T, TOutput>(this IQueryable<T> source, Expression<Func<T, T>> setter, Expression<Func<T, T, TOutput>> outputExpression, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source data query. |
Expression<Func<T, T>> | setter | Update expression. Uses updated record as parameter. Expression supports only target table record new expression with field initializers. |
Expression<Func<T, T, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<TOutput[]> | Output values from the update statement. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
TOutput | Output table record type. |
Remarks
Database support:
UpdateWithOutputAsync<TSource, TTarget>(IQueryable<TSource>, Expression<Func<TSource, TTarget>>, Expression<Func<TSource, TTarget>>, CancellationToken)
Executes update-from-source operation against target table.
Declaration
public static Task<UpdateOutput<TTarget>[]> UpdateWithOutputAsync<TSource, TTarget>(this IQueryable<TSource> source, Expression<Func<TSource, TTarget>> target, Expression<Func<TSource, TTarget>> setter, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
Expression<Func<TSource, TTarget>> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<UpdateOutput<TTarget>[]> | Deleted and inserted values for every record updated. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
Remarks
Database support:
UpdateWithOutputAsync<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, CancellationToken)
Executes update-from-source operation against target table.
Declaration
public static Task<UpdateOutput<TTarget>[]> UpdateWithOutputAsync<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, CancellationToken token = null)
where TTarget : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<UpdateOutput<TTarget>[]> | Deleted and inserted values for every record updated. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
Remarks
Database support:
UpdateWithOutputAsync<T, TOutput>(IUpdatable<T>, Expression<Func<T, T, TOutput>>, CancellationToken)
Executes update operation using source query as record filter.
Declaration
public static Task<TOutput[]> UpdateWithOutputAsync<T, TOutput>(this IUpdatable<T> source, Expression<Func<T, T, TOutput>> outputExpression, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IUpdatable<T> | source | Source data query. |
Expression<Func<T, T, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<TOutput[]> | Output values from the update statement. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
TOutput | Output table record type. |
Remarks
Database support:
UpdateWithOutputAsync<TSource, TTarget, TOutput>(IQueryable<TSource>, Expression<Func<TSource, TTarget>>, Expression<Func<TSource, TTarget>>, Expression<Func<TSource, TTarget, TTarget, TOutput>>, CancellationToken)
Executes update-from-source operation against target table.
Declaration
public static Task<TOutput[]> UpdateWithOutputAsync<TSource, TTarget, TOutput>(this IQueryable<TSource> source, Expression<Func<TSource, TTarget>> target, Expression<Func<TSource, TTarget>> setter, Expression<Func<TSource, TTarget, TTarget, TOutput>> outputExpression, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
Expression<Func<TSource, TTarget>> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
Expression<Func<TSource, TTarget, TTarget, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<TOutput[]> | Output values from the update statement. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
TOutput | Output table record type. |
Remarks
Database support:
UpdateWithOutputAsync<TSource, TTarget, TOutput>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, Expression<Func<TSource, TTarget, TTarget, TOutput>>, CancellationToken)
Executes update-from-source operation against target table.
Declaration
public static Task<TOutput[]> UpdateWithOutputAsync<TSource, TTarget, TOutput>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, Expression<Func<TSource, TTarget, TTarget, TOutput>> outputExpression, CancellationToken token = null)
where TTarget : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
Expression<Func<TSource, TTarget, TTarget, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<TOutput[]> | Output values from the update statement. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
TOutput | Output table record type. |
Remarks
Database support:
UpdateWithOutputInto<T>(IQueryable<T>, Expression<Func<T, T>>, ITable<T>)
Executes update operation using source query as record filter.
Declaration
public static int UpdateWithOutputInto<T>(this IQueryable<T> source, Expression<Func<T, T>> setter, ITable<T> outputTable)
where T : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source data query. |
Expression<Func<T, T>> | setter | Update expression. Uses updated record as parameter. Expression supports only target table record new expression with field initializers. |
ITable<T> | outputTable | Output table. |
Returns
Type | Description |
---|---|
System.Int32 | Number of updated records. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
Remarks
Database support:
UpdateWithOutputInto<T>(IUpdatable<T>, ITable<T>)
Executes update operation using source query as record filter.
Declaration
public static int UpdateWithOutputInto<T>(this IUpdatable<T> source, ITable<T> outputTable)
where T : class
Parameters
Type | Name | Description |
---|---|---|
IUpdatable<T> | source | Source data query. |
ITable<T> | outputTable | Output table. |
Returns
Type | Description |
---|---|
System.Int32 | Number of updated records. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
Remarks
Database support:
UpdateWithOutputInto<T, TOutput>(IQueryable<T>, Expression<Func<T, T>>, ITable<TOutput>, Expression<Func<T, T, TOutput>>)
Executes update operation using source query as record filter.
Declaration
public static int UpdateWithOutputInto<T, TOutput>(this IQueryable<T> source, Expression<Func<T, T>> setter, ITable<TOutput> outputTable, Expression<Func<T, T, TOutput>> outputExpression)
where TOutput : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source data query. |
Expression<Func<T, T>> | setter | Update expression. Uses updated record as parameter. Expression supports only target table record new expression with field initializers. |
ITable<TOutput> | outputTable | Output table. |
Expression<Func<T, T, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
Returns
Type | Description |
---|---|
System.Int32 | Number of updated records. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
TOutput | Output table record type. |
Remarks
Database support:
UpdateWithOutputInto<TSource, TTarget>(IQueryable<TSource>, Expression<Func<TSource, TTarget>>, Expression<Func<TSource, TTarget>>, ITable<TTarget>)
Executes update-from-source operation against target table.
Declaration
public static int UpdateWithOutputInto<TSource, TTarget>(this IQueryable<TSource> source, Expression<Func<TSource, TTarget>> target, Expression<Func<TSource, TTarget>> setter, ITable<TTarget> outputTable)
where TTarget : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
Expression<Func<TSource, TTarget>> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
ITable<TTarget> | outputTable | Output table. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
Remarks
Database support:
UpdateWithOutputInto<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, ITable<TTarget>)
Executes update-from-source operation against target table.
Declaration
public static int UpdateWithOutputInto<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, ITable<TTarget> outputTable)
where TTarget : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
ITable<TTarget> | outputTable | Output table. |
Returns
Type | Description |
---|---|
System.Int32 | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
Remarks
Database support:
UpdateWithOutputInto<T, TOutput>(IUpdatable<T>, ITable<TOutput>, Expression<Func<T, T, TOutput>>)
Executes update operation using source query as record filter.
Declaration
public static int UpdateWithOutputInto<T, TOutput>(this IUpdatable<T> source, ITable<TOutput> outputTable, Expression<Func<T, T, TOutput>> outputExpression)
where TOutput : class
Parameters
Type | Name | Description |
---|---|---|
IUpdatable<T> | source | Source data query. |
ITable<TOutput> | outputTable | Output table. |
Expression<Func<T, T, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
Returns
Type | Description |
---|---|
System.Int32 | Number of updated records. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
TOutput | Output table record type. |
Remarks
Database support:
UpdateWithOutputInto<TSource, TTarget, TOutput>(IQueryable<TSource>, Expression<Func<TSource, TTarget>>, Expression<Func<TSource, TTarget>>, ITable<TOutput>, Expression<Func<TSource, TTarget, TTarget, TOutput>>)
Executes update-from-source operation against target table.
Declaration
public static int UpdateWithOutputInto<TSource, TTarget, TOutput>(this IQueryable<TSource> source, Expression<Func<TSource, TTarget>> target, Expression<Func<TSource, TTarget>> setter, ITable<TOutput> outputTable, Expression<Func<TSource, TTarget, TTarget, TOutput>> outputExpression)
where TOutput : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
Expression<Func<TSource, TTarget>> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
ITable<TOutput> | outputTable | Output table. |
Expression<Func<TSource, TTarget, TTarget, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
Returns
Type | Description |
---|---|
System.Int32 | Output values from the update statement. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
TOutput | Output table record type. |
Remarks
Database support:
UpdateWithOutputInto<TSource, TTarget, TOutput>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, ITable<TOutput>, Expression<Func<TSource, TTarget, TTarget, TOutput>>)
Executes update-from-source operation against target table.
Declaration
public static int UpdateWithOutputInto<TSource, TTarget, TOutput>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, ITable<TOutput> outputTable, Expression<Func<TSource, TTarget, TTarget, TOutput>> outputExpression)
where TTarget : class where TOutput : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
ITable<TOutput> | outputTable | Output table. |
Expression<Func<TSource, TTarget, TTarget, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
Returns
Type | Description |
---|---|
System.Int32 | Output values from the update statement. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
TOutput | Output table record type. |
Remarks
Database support:
UpdateWithOutputIntoAsync<T>(IQueryable<T>, Expression<Func<T, T>>, ITable<T>, CancellationToken)
Executes update operation using source query as record filter.
Declaration
public static Task<int> UpdateWithOutputIntoAsync<T>(this IQueryable<T> source, Expression<Func<T, T>> setter, ITable<T> outputTable, CancellationToken token = null)
where T : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source data query. |
Expression<Func<T, T>> | setter | Update expression. Uses updated record as parameter. Expression supports only target table record new expression with field initializers. |
ITable<T> | outputTable | Output table. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of updated records. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
Remarks
Database support:
UpdateWithOutputIntoAsync<T>(IUpdatable<T>, ITable<T>, CancellationToken)
Executes update operation using source query as record filter.
Declaration
public static Task<int> UpdateWithOutputIntoAsync<T>(this IUpdatable<T> source, ITable<T> outputTable, CancellationToken token = null)
where T : class
Parameters
Type | Name | Description |
---|---|---|
IUpdatable<T> | source | Source data query. |
ITable<T> | outputTable | Output table. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of updated records. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
Remarks
Database support:
UpdateWithOutputIntoAsync<T, TOutput>(IQueryable<T>, Expression<Func<T, T>>, ITable<TOutput>, Expression<Func<T, T, TOutput>>, CancellationToken)
Executes update operation using source query as record filter.
Declaration
public static Task<int> UpdateWithOutputIntoAsync<T, TOutput>(this IQueryable<T> source, Expression<Func<T, T>> setter, ITable<TOutput> outputTable, Expression<Func<T, T, TOutput>> outputExpression, CancellationToken token = null)
where TOutput : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | source | Source data query. |
Expression<Func<T, T>> | setter | Update expression. Uses updated record as parameter. Expression supports only target table record new expression with field initializers. |
ITable<TOutput> | outputTable | Output table. |
Expression<Func<T, T, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of updated records. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
TOutput | Output table record type. |
Remarks
Database support:
UpdateWithOutputIntoAsync<TSource, TTarget>(IQueryable<TSource>, Expression<Func<TSource, TTarget>>, Expression<Func<TSource, TTarget>>, ITable<TTarget>, CancellationToken)
Executes update-from-source operation against target table.
Declaration
public static Task<int> UpdateWithOutputIntoAsync<TSource, TTarget>(this IQueryable<TSource> source, Expression<Func<TSource, TTarget>> target, Expression<Func<TSource, TTarget>> setter, ITable<TTarget> outputTable, CancellationToken token = null)
where TTarget : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
Expression<Func<TSource, TTarget>> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
ITable<TTarget> | outputTable | Output table. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
Remarks
Database support:
UpdateWithOutputIntoAsync<TSource, TTarget>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, ITable<TTarget>, CancellationToken)
Executes update-from-source operation against target table.
Declaration
public static Task<int> UpdateWithOutputIntoAsync<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, ITable<TTarget> outputTable, CancellationToken token = null)
where TTarget : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
ITable<TTarget> | outputTable | Output table. |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of affected records. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
Remarks
Database support:
UpdateWithOutputIntoAsync<T, TOutput>(IUpdatable<T>, ITable<TOutput>, Expression<Func<T, T, TOutput>>, CancellationToken)
Executes update operation using source query as record filter.
Declaration
public static Task<int> UpdateWithOutputIntoAsync<T, TOutput>(this IUpdatable<T> source, ITable<TOutput> outputTable, Expression<Func<T, T, TOutput>> outputExpression, CancellationToken token = null)
where TOutput : class
Parameters
Type | Name | Description |
---|---|---|
IUpdatable<T> | source | Source data query. |
ITable<TOutput> | outputTable | Output table. |
Expression<Func<T, T, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Number of updated records. |
Type Parameters
Name | Description |
---|---|
T | Updated table record type. |
TOutput | Output table record type. |
Remarks
Database support:
UpdateWithOutputIntoAsync<TSource, TTarget, TOutput>(IQueryable<TSource>, Expression<Func<TSource, TTarget>>, Expression<Func<TSource, TTarget>>, ITable<TOutput>, Expression<Func<TSource, TTarget, TTarget, TOutput>>, CancellationToken)
Executes update-from-source operation against target table.
Declaration
public static Task<int> UpdateWithOutputIntoAsync<TSource, TTarget, TOutput>(this IQueryable<TSource> source, Expression<Func<TSource, TTarget>> target, Expression<Func<TSource, TTarget>> setter, ITable<TOutput> outputTable, Expression<Func<TSource, TTarget, TTarget, TOutput>> outputExpression, CancellationToken token = null)
where TOutput : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
Expression<Func<TSource, TTarget>> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
ITable<TOutput> | outputTable | Output table. |
Expression<Func<TSource, TTarget, TTarget, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Output values from the update statement. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
TOutput | Output table record type. |
Remarks
Database support:
UpdateWithOutputIntoAsync<TSource, TTarget, TOutput>(IQueryable<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>, ITable<TOutput>, Expression<Func<TSource, TTarget, TTarget, TOutput>>, CancellationToken)
Executes update-from-source operation against target table.
Declaration
public static Task<int> UpdateWithOutputIntoAsync<TSource, TTarget, TOutput>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter, ITable<TOutput> outputTable, Expression<Func<TSource, TTarget, TTarget, TOutput>> outputExpression, CancellationToken token = null)
where TTarget : class where TOutput : class
Parameters
Type | Name | Description |
---|---|---|
IQueryable<TSource> | source | Source data query. |
ITable<TTarget> | target | Target table. |
Expression<Func<TSource, TTarget>> | setter | Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers. |
ITable<TOutput> | outputTable | Output table. |
Expression<Func<TSource, TTarget, TTarget, TOutput>> | outputExpression | Output record constructor expression.
Parameters passed are as follows: ( |
CancellationToken | token | Optional asynchronous operation cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int32> | Output values from the update statement. |
Type Parameters
Name | Description |
---|---|
TSource | Source query record type. |
TTarget | Target table mapping class. |
TOutput | Output table record type. |
Remarks
Database support:
Using<TTarget, TSource>(IMergeableUsing<TTarget>, IEnumerable<TSource>)
Adds source collection to merge command definition.
Declaration
public static IMergeableOn<TTarget, TSource> Using<TTarget, TSource>(this IMergeableUsing<TTarget> merge, IEnumerable<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
IMergeableUsing<TTarget> | merge | Merge command builder. |
IEnumerable<TSource> | source | Source data collection. |
Returns
Type | Description |
---|---|
IMergeableOn<TTarget, TSource> | Returns merge command builder with source and target set. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
Using<TTarget, TSource>(IMergeableUsing<TTarget>, IQueryable<TSource>)
Adds source query to merge command definition.
Declaration
public static IMergeableOn<TTarget, TSource> Using<TTarget, TSource>(this IMergeableUsing<TTarget> merge, IQueryable<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
IMergeableUsing<TTarget> | merge | Merge command builder. |
IQueryable<TSource> | source | Source data query. |
Returns
Type | Description |
---|---|
IMergeableOn<TTarget, TSource> | Returns merge command builder with source and target set. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
TSource | Source record type. |
UsingTarget<TTarget>(IMergeableUsing<TTarget>)
Sets target table as merge command source.
Declaration
public static IMergeableOn<TTarget, TTarget> UsingTarget<TTarget>(this IMergeableUsing<TTarget> merge)
Parameters
Type | Name | Description |
---|---|---|
IMergeableUsing<TTarget> | merge | Merge command builder. |
Returns
Type | Description |
---|---|
IMergeableOn<TTarget, TTarget> | Returns merge command builder with source and target set. |
Type Parameters
Name | Description |
---|---|
TTarget | Target record type. |
Value<T, TV>(ITable<T>, Expression<Func<T, TV>>, TV)
Starts insert operation LINQ query definition from field setter expression.
Declaration
public static IValueInsertable<T> Value<T, TV>(this ITable<T> source, Expression<Func<T, TV>> field, TV value)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | source | Source table to insert to. |
Expression<Func<T, TV>> | field | Setter field selector expression. |
TV | value | Setter field value. |
Returns
Type | Description |
---|---|
IValueInsertable<T> | Insert query. |
Type Parameters
Name | Description |
---|---|
T | Target table record type. |
TV | Setter field type. |
Value<T, TV>(ITable<T>, Expression<Func<T, TV>>, Expression<Func<TV>>)
Starts insert operation LINQ query definition from field setter expression.
Declaration
public static IValueInsertable<T> Value<T, TV>(this ITable<T> source, Expression<Func<T, TV>> field, Expression<Func<TV>> value)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | source | Source table to insert to. |
Expression<Func<T, TV>> | field | Setter field selector expression. |
Expression<Func<TV>> | value | Setter field value expression. |
Returns
Type | Description |
---|---|
IValueInsertable<T> | Insert query. |
Type Parameters
Name | Description |
---|---|
T | Target table record type. |
TV | Setter field type. |
Value<T, TV>(IValueInsertable<T>, Expression<Func<T, TV>>, TV)
Add field setter to insert operation LINQ query.
Declaration
public static IValueInsertable<T> Value<T, TV>(this IValueInsertable<T> source, Expression<Func<T, TV>> field, TV value)
Parameters
Type | Name | Description |
---|---|---|
IValueInsertable<T> | source | Insert query. |
Expression<Func<T, TV>> | field | Setter field selector expression. |
TV | value | Setter field value. |
Returns
Type | Description |
---|---|
IValueInsertable<T> | Insert query. |
Type Parameters
Name | Description |
---|---|
T | Target table record type. |
TV | Setter field type. |
Value<T, TV>(IValueInsertable<T>, Expression<Func<T, TV>>, Expression<Func<TV>>)
Add field setter to insert operation LINQ query.
Declaration
public static IValueInsertable<T> Value<T, TV>(this IValueInsertable<T> source, Expression<Func<T, TV>> field, Expression<Func<TV>> value)
Parameters
Type | Name | Description |
---|---|---|
IValueInsertable<T> | source | Insert query. |
Expression<Func<T, TV>> | field | Setter field selector expression. |
Expression<Func<TV>> | value | Setter field value expression. |
Returns
Type | Description |
---|---|
IValueInsertable<T> | Insert query. |
Type Parameters
Name | Description |
---|---|
T | Target table record type. |
TV | Setter field type. |
Value<TSource, TTarget, TValue>(ISelectInsertable<TSource, TTarget>, Expression<Func<TTarget, TValue>>, TValue)
Add field setter to insert operation LINQ query.
Declaration
public static ISelectInsertable<TSource, TTarget> Value<TSource, TTarget, TValue>(this ISelectInsertable<TSource, TTarget> source, Expression<Func<TTarget, TValue>> field, TValue value)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
Expression<Func<TTarget, TValue>> | field | Setter field selector expression. |
TValue | value | Setter field value. |
Returns
Type | Description |
---|---|
ISelectInsertable<TSource, TTarget> | Insert query. |
Type Parameters
Name | Description |
---|---|
TSource | Source record type. |
TTarget | Target record type |
TValue | Field type. |
Value<TSource, TTarget, TValue>(ISelectInsertable<TSource, TTarget>, Expression<Func<TTarget, TValue>>, Expression<Func<TSource, TValue>>)
Add field setter to insert operation LINQ query.
Declaration
public static ISelectInsertable<TSource, TTarget> Value<TSource, TTarget, TValue>(this ISelectInsertable<TSource, TTarget> source, Expression<Func<TTarget, TValue>> field, Expression<Func<TSource, TValue>> value)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
Expression<Func<TTarget, TValue>> | field | Setter field selector expression. |
Expression<Func<TSource, TValue>> | value | Setter field value expression. Accepts source record as parameter. |
Returns
Type | Description |
---|---|
ISelectInsertable<TSource, TTarget> | Insert query. |
Type Parameters
Name | Description |
---|---|
TSource | Source record type. |
TTarget | Target record type |
TValue | Field type. |
Value<TSource, TTarget, TValue>(ISelectInsertable<TSource, TTarget>, Expression<Func<TTarget, TValue>>, Expression<Func<TValue>>)
Add field setter to insert operation LINQ query.
Declaration
public static ISelectInsertable<TSource, TTarget> Value<TSource, TTarget, TValue>(this ISelectInsertable<TSource, TTarget> source, Expression<Func<TTarget, TValue>> field, Expression<Func<TValue>> value)
Parameters
Type | Name | Description |
---|---|---|
ISelectInsertable<TSource, TTarget> | source | Insert query. |
Expression<Func<TTarget, TValue>> | field | Setter field selector expression. |
Expression<Func<TValue>> | value | Setter field value expression. |
Returns
Type | Description |
---|---|
ISelectInsertable<TSource, TTarget> | Insert query. |
Type Parameters
Name | Description |
---|---|
TSource | Source record type. |
TTarget | Target record type |
TValue | Field type. |
With<TSource>(ITable<TSource>, String)
Adds a table hint to a table in generated query.
Declaration
public static ITable<TSource> With<TSource>(this ITable<TSource> table, string hint)
Parameters
Type | Name | Description |
---|---|---|
ITable<TSource> | table | Table-like query source. |
System.String | hint | SQL text, added as a database specific hint to generated query. |
Returns
Type | Description |
---|---|
ITable<TSource> | Table-like query source with table hints. |
Type Parameters
Name | Description |
---|---|
TSource | Table record mapping class. |
WithTableExpression<T>(ITable<T>, String)
Replaces access to a table in generated query with SQL expression. Example below adds hint to a table. Also see With<TSource>(ITable<TSource>, String) method.
var tableWithHint = db.Table.WithTableExpression("{0} {1} with (UpdLock)");
Declaration
public static ITable<T> WithTableExpression<T>(this ITable<T> table, string expression)
Parameters
Type | Name | Description |
---|---|---|
ITable<T> | table | Table-like query source. |
System.String | expression | SQL template to use instead of table name. Template supports two parameters: - {0} original table name; - {1} table alias. |
Returns
Type | Description |
---|---|
ITable<T> | Table-like query source with new table source expression. |
Type Parameters
Name | Description |
---|---|
T | Table record mapping class. |