Search Results for

    Show / Hide Table of Contents

    Class TempTable<T>

    Temporary table. Temporary table is a table, created when you create instance of this class and deleted when you dispose it. It uses regular tables even if underlying database supports temporary tables concept.

    Inheritance
    System.Object
    TempTable<T>
    Implements
    ITable<T>
    IExpressionQuery<T>
    IOrderedQueryable<T>
    IQueryProviderAsync
    IQueryProvider
    IExpressionQuery
    ITableMutable<T>
    IDisposable
    IAsyncDisposable
    Namespace: LinqToDB
    Assembly: linq2db.dll
    Syntax
    public class TempTable<T> : object, ITable<T>, IExpressionQuery<T>, IQueryProviderAsync, IExpressionQuery, ITableMutable<T>, IAsyncDisposable
    Type Parameters
    Name Description
    T

    Table record mapping class.

    Constructors

    | Improve this Doc View Source

    TempTable(IDataContext, IEnumerable<T>, BulkCopyOptions, Nullable<String>, Nullable<String>, Nullable<String>, Nullable<String>, TableOptions)

    Creates new temporary table and populate it using BulkCopy.

    Declaration
    public TempTable(IDataContext db, IEnumerable<T> items, BulkCopyOptions options = null, string? tableName = null, string? databaseName = null, string? schemaName = null, string? serverName = null, TableOptions tableOptions = (TableOptions)0)
    Parameters
    Type Name Description
    IDataContext db

    Database connection instance.

    IEnumerable<T> items

    Initial records to insert into created table.

    BulkCopyOptions options

    Optional BulkCopy options.

    System.Nullable<System.String> tableName

    Optional name of temporary table. If not specified, value from mapping will be used.

    System.Nullable<System.String> databaseName

    Optional name of table's database. If not specified, value from mapping will be used.

    System.Nullable<System.String> schemaName

    Optional name of table schema/owner. If not specified, value from mapping will be used.

    System.Nullable<System.String> serverName

    Optional name of linked server. If not specified, value from mapping will be used.

    TableOptions tableOptions

    Optional Table options. If not specified, value from mapping will be used.

    | Improve this Doc View Source

    TempTable(IDataContext, IQueryable<T>, Nullable<String>, Nullable<String>, Nullable<String>, Nullable<Action<ITable<T>>>, Nullable<String>, TableOptions)

    Creates new temporary table and populate it using data from provided query.

    Declaration
    public TempTable(IDataContext db, IQueryable<T> items, string? tableName = null, string? databaseName = null, string? schemaName = null, Action<ITable<T>>? action = null, string? serverName = null, TableOptions tableOptions = (TableOptions)0)
    Parameters
    Type Name Description
    IDataContext db

    Database connection instance.

    IQueryable<T> items

    Query to get records to populate created table with initial data.

    System.Nullable<System.String> tableName

    Optional name of temporary table. If not specified, value from mapping will be used.

    System.Nullable<System.String> databaseName

    Optional name of table's database. If not specified, value from mapping will be used.

    System.Nullable<System.String> schemaName

    Optional name of table schema/owner. If not specified, value from mapping will be used.

    System.Nullable<Action<ITable<T>>> action

    Optional action that will be executed after table creation but before it populated with data from items.

    System.Nullable<System.String> serverName

    Optional name of linked server. If not specified, value from mapping will be used.

    TableOptions tableOptions

    Optional Table options. If not specified, value from mapping will be used.

    | Improve this Doc View Source

    TempTable(IDataContext, Nullable<String>, IEnumerable<T>, BulkCopyOptions, Nullable<String>, Nullable<String>, Nullable<String>, TableOptions)

    Creates new temporary table and populate it using BulkCopy.

    Declaration
    public TempTable(IDataContext db, string? tableName, IEnumerable<T> items, BulkCopyOptions options = null, string? databaseName = null, string? schemaName = null, string? serverName = null, TableOptions tableOptions = (TableOptions)0)
    Parameters
    Type Name Description
    IDataContext db

    Database connection instance.

    System.Nullable<System.String> tableName

    Optional name of temporary table. If not specified, value from mapping will be used.

    IEnumerable<T> items

    Initial records to insert into created table.

    BulkCopyOptions options

    Optional BulkCopy options.

    System.Nullable<System.String> databaseName

    Optional name of table's database. If not specified, value from mapping will be used.

    System.Nullable<System.String> schemaName

    Optional name of table schema/owner. If not specified, value from mapping will be used.

    System.Nullable<System.String> serverName

    Optional name of linked server. If not specified, value from mapping will be used.

    TableOptions tableOptions

    Optional Table options. If not specified, value from mapping will be used.

    | Improve this Doc View Source

    TempTable(IDataContext, Nullable<String>, IQueryable<T>, Nullable<String>, Nullable<String>, Nullable<Action<ITable<T>>>, Nullable<String>, TableOptions)

    Creates new temporary table and populate it using data from provided query.

    Declaration
    public TempTable(IDataContext db, string? tableName, IQueryable<T> items, string? databaseName = null, string? schemaName = null, Action<ITable<T>>? action = null, string? serverName = null, TableOptions tableOptions = (TableOptions)0)
    Parameters
    Type Name Description
    IDataContext db

    Database connection instance.

    System.Nullable<System.String> tableName

    Optional name of temporary table. If not specified, value from mapping will be used.

    IQueryable<T> items

    Query to get records to populate created table with initial data.

    System.Nullable<System.String> databaseName

    Optional name of table's database. If not specified, value from mapping will be used.

    System.Nullable<System.String> schemaName

    Optional name of table schema/owner. If not specified, value from mapping will be used.

    System.Nullable<Action<ITable<T>>> action

    Optional action that will be executed after table creation but before it populated with data from items.

    System.Nullable<System.String> serverName

    Optional name of linked server. If not specified, value from mapping will be used.

    TableOptions tableOptions

    Optional Table options. If not specified, value from mapping will be used.

    | Improve this Doc View Source

    TempTable(IDataContext, Nullable<String>, Nullable<String>, Nullable<String>, Nullable<String>, TableOptions)

    Creates new temporary table.

    Declaration
    public TempTable(IDataContext db, string? tableName = null, string? databaseName = null, string? schemaName = null, string? serverName = null, TableOptions tableOptions = (TableOptions)0)
    Parameters
    Type Name Description
    IDataContext db

    Database connection instance.

    System.Nullable<System.String> tableName

    Optional name of temporary table. If not specified, value from mapping will be used.

    System.Nullable<System.String> databaseName

    Optional name of table's database. If not specified, value from mapping will be used.

    System.Nullable<System.String> schemaName

    Optional name of table schema/owner. If not specified, value from mapping will be used.

    System.Nullable<System.String> serverName

    Optional name of linked server. If not specified, value from mapping will be used.

    TableOptions tableOptions

    Optional Table options. If not specified, value from mapping will be used.

    | Improve this Doc View Source

    TempTable(ITable<T>)

    Configures a temporary table that will be dropped when this instance is disposed

    Declaration
    protected TempTable(ITable<T> table)
    Parameters
    Type Name Description
    ITable<T> table

    Table instance.

    Fields

    | Improve this Doc View Source

    TotalCopied

    Gets total number of records, inserted into table using BulkCopy.

    Declaration
    public long TotalCopied
    Field Value
    Type Description
    System.Int64

    Properties

    | Improve this Doc View Source

    DatabaseName

    Declaration
    public string? DatabaseName { get; }
    Property Value
    Type Description
    System.Nullable<System.String>
    | Improve this Doc View Source

    DataContext

    Gets data connection, associated with current table.

    Declaration
    public IDataContext DataContext { get; }
    Property Value
    Type Description
    IDataContext
    | Improve this Doc View Source

    SchemaName

    Declaration
    public string? SchemaName { get; }
    Property Value
    Type Description
    System.Nullable<System.String>
    | Improve this Doc View Source

    ServerName

    Declaration
    public string? ServerName { get; }
    Property Value
    Type Description
    System.Nullable<System.String>
    | Improve this Doc View Source

    TableID

    Declaration
    public string? TableID { get; }
    Property Value
    Type Description
    System.Nullable<System.String>
    | Improve this Doc View Source

    TableName

    Declaration
    public string TableName { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    TableOptions

    Declaration
    public TableOptions TableOptions { get; }
    Property Value
    Type Description
    TableOptions

    Methods

    | Improve this Doc View Source

    Copy(IEnumerable<T>, BulkCopyOptions)

    Insert new records into table using BulkCopy.

    Declaration
    public long Copy(IEnumerable<T> items, BulkCopyOptions options = null)
    Parameters
    Type Name Description
    IEnumerable<T> items

    Records to insert into table.

    BulkCopyOptions options

    Optional BulkCopy options.

    Returns
    Type Description
    System.Int64

    Number of records, inserted into table.

    | Improve this Doc View Source

    CopyAsync(IEnumerable<T>, BulkCopyOptions, CancellationToken)

    Insert new records into table using BulkCopy.

    Declaration
    public async Task<long> CopyAsync(IEnumerable<T> items, BulkCopyOptions options = null, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    IEnumerable<T> items

    Records to insert into table.

    BulkCopyOptions options

    Optional BulkCopy options.

    CancellationToken cancellationToken

    Asynchronous operation cancellation token.

    Returns
    Type Description
    Task<System.Int64>

    Number of records, inserted into table.

    | Improve this Doc View Source

    CreateAsync(IDataContext, IEnumerable<T>, BulkCopyOptions, Nullable<String>, Nullable<String>, Nullable<String>, Nullable<String>, TableOptions, CancellationToken)

    Creates new temporary table and populate it using BulkCopy.

    Declaration
    public static Task<TempTable<T>> CreateAsync(IDataContext db, IEnumerable<T> items, BulkCopyOptions options = null, string? tableName = null, string? databaseName = null, string? schemaName = null, string? serverName = null, TableOptions tableOptions = (TableOptions)0, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    IDataContext db

    Database connection instance.

    IEnumerable<T> items

    Initial records to insert into created table.

    BulkCopyOptions options

    Optional BulkCopy options.

    System.Nullable<System.String> tableName

    Optional name of temporary table. If not specified, value from mapping will be used.

    System.Nullable<System.String> databaseName

    Optional name of table's database. If not specified, value from mapping will be used.

    System.Nullable<System.String> schemaName

    Optional name of table schema/owner. If not specified, value from mapping will be used.

    System.Nullable<System.String> serverName

    Optional name of linked server. If not specified, value from mapping will be used.

    TableOptions tableOptions

    Optional Table options. If not specified, value from mapping will be used.

    CancellationToken cancellationToken

    Asynchronous operation cancellation token.

    Returns
    Type Description
    Task<TempTable<T>>
    | Improve this Doc View Source

    CreateAsync(IDataContext, IQueryable<T>, Nullable<String>, Nullable<String>, Nullable<String>, Nullable<Func<ITable<T>, Task>>, Nullable<String>, TableOptions, CancellationToken)

    Creates new temporary table and populate it using data from provided query.

    Declaration
    public static async Task<TempTable<T>> CreateAsync(IDataContext db, IQueryable<T> items, string? tableName = null, string? databaseName = null, string? schemaName = null, Func<ITable<T>, Task>? action = null, string? serverName = null, TableOptions tableOptions = (TableOptions)0, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    IDataContext db

    Database connection instance.

    IQueryable<T> items

    Query to get records to populate created table with initial data.

    System.Nullable<System.String> tableName

    Optional name of temporary table. If not specified, value from mapping will be used.

    System.Nullable<System.String> databaseName

    Optional name of table's database. If not specified, value from mapping will be used.

    System.Nullable<System.String> schemaName

    Optional name of table schema/owner. If not specified, value from mapping will be used.

    System.Nullable<Func<ITable<T>, Task>> action

    Optional asynchronous action that will be executed after table creation but before it populated with data from items.

    System.Nullable<System.String> serverName

    Optional name of linked server. If not specified, value from mapping will be used.

    TableOptions tableOptions

    Optional Table options. If not specified, value from mapping will be used.

    CancellationToken cancellationToken

    Asynchronous operation cancellation token.

    Returns
    Type Description
    Task<TempTable<T>>
    | Improve this Doc View Source

    CreateAsync(IDataContext, Nullable<String>, IEnumerable<T>, BulkCopyOptions, Nullable<String>, Nullable<String>, Nullable<String>, TableOptions, CancellationToken)

    Creates new temporary table and populate it using BulkCopy.

    Declaration
    public static async Task<TempTable<T>> CreateAsync(IDataContext db, string? tableName, IEnumerable<T> items, BulkCopyOptions options = null, string? databaseName = null, string? schemaName = null, string? serverName = null, TableOptions tableOptions = (TableOptions)0, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    IDataContext db

    Database connection instance.

    System.Nullable<System.String> tableName

    Optional name of temporary table. If not specified, value from mapping will be used.

    IEnumerable<T> items

    Initial records to insert into created table.

    BulkCopyOptions options

    Optional BulkCopy options.

    System.Nullable<System.String> databaseName

    Optional name of table's database. If not specified, value from mapping will be used.

    System.Nullable<System.String> schemaName

    Optional name of table schema/owner. If not specified, value from mapping will be used.

    System.Nullable<System.String> serverName

    Optional name of linked server. If not specified, value from mapping will be used.

    TableOptions tableOptions

    Optional Table options. If not specified, value from mapping will be used.

    CancellationToken cancellationToken

    Asynchronous operation cancellation token.

    Returns
    Type Description
    Task<TempTable<T>>
    | Improve this Doc View Source

    CreateAsync(IDataContext, Nullable<String>, IQueryable<T>, Nullable<String>, Nullable<String>, Nullable<Func<ITable<T>, Task>>, Nullable<String>, TableOptions, CancellationToken)

    Creates new temporary table and populate it using data from provided query.

    Declaration
    public static Task<TempTable<T>> CreateAsync(IDataContext db, string? tableName, IQueryable<T> items, string? databaseName = null, string? schemaName = null, Func<ITable<T>, Task>? action = null, string? serverName = null, TableOptions tableOptions = (TableOptions)0, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    IDataContext db

    Database connection instance.

    System.Nullable<System.String> tableName

    Optional name of temporary table. If not specified, value from mapping will be used.

    IQueryable<T> items

    Query to get records to populate created table with initial data.

    System.Nullable<System.String> databaseName

    Optional name of table's database. If not specified, value from mapping will be used.

    System.Nullable<System.String> schemaName

    Optional name of table schema/owner. If not specified, value from mapping will be used.

    System.Nullable<Func<ITable<T>, Task>> action

    Optional asynchronous action that will be executed after table creation but before it populated with data from items.

    System.Nullable<System.String> serverName

    Optional name of linked server. If not specified, value from mapping will be used.

    TableOptions tableOptions

    Optional Table options. If not specified, value from mapping will be used.

    CancellationToken cancellationToken

    Asynchronous operation cancellation token.

    Returns
    Type Description
    Task<TempTable<T>>
    | Improve this Doc View Source

    CreateAsync(IDataContext, Nullable<String>, Nullable<String>, Nullable<String>, Nullable<String>, TableOptions, CancellationToken)

    Creates new temporary table.

    Declaration
    public static async Task<TempTable<T>> CreateAsync(IDataContext db, string? tableName = null, string? databaseName = null, string? schemaName = null, string? serverName = null, TableOptions tableOptions = (TableOptions)0, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    IDataContext db

    Database connection instance.

    System.Nullable<System.String> tableName

    Optional name of temporary table. If not specified, value from mapping will be used.

    System.Nullable<System.String> databaseName

    Optional name of table's database. If not specified, value from mapping will be used.

    System.Nullable<System.String> schemaName

    Optional name of table schema/owner. If not specified, value from mapping will be used.

    System.Nullable<System.String> serverName

    Optional name of linked server. If not specified, value from mapping will be used.

    TableOptions tableOptions

    Optional Table options. If not specified, value from mapping will be used.

    CancellationToken cancellationToken

    Asynchronous operation cancellation token.

    Returns
    Type Description
    Task<TempTable<T>>
    | Improve this Doc View Source

    Dispose()

    Declaration
    public virtual void Dispose()
    | Improve this Doc View Source

    DisposeAsync()

    Declaration
    public virtual Task DisposeAsync()
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    Insert(IQueryable<T>)

    Insert data into table using records, returned by provided query.

    Declaration
    public long Insert(IQueryable<T> items)
    Parameters
    Type Name Description
    IQueryable<T> items

    Query with records to insert into temporary table.

    Returns
    Type Description
    System.Int64

    Number of records, inserted into table.

    | Improve this Doc View Source

    InsertAsync(IQueryable<T>, CancellationToken)

    Insert data into table using records, returned by provided query.

    Declaration
    public async Task<long> InsertAsync(IQueryable<T> items, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    IQueryable<T> items

    Query with records to insert into temporary table.

    CancellationToken cancellationToken

    Asynchronous operation cancellation token.

    Returns
    Type Description
    Task<System.Int64>

    Number of records, inserted into table.

    Explicit Interface Implementations

    | Improve this Doc View Source

    IQueryProviderAsync.ExecuteAsync<TResult>(Expression, CancellationToken)

    Declaration
    Task<TResult> IQueryProviderAsync.ExecuteAsync<TResult>(Expression expression, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    Expression expression
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<TResult>
    Type Parameters
    Name Description
    TResult
    | Improve this Doc View Source

    IQueryProviderAsync.ExecuteAsyncEnumerable<TResult>(Expression, CancellationToken)

    Declaration
    Task<IAsyncEnumerable<TResult>> IQueryProviderAsync.ExecuteAsyncEnumerable<TResult>(Expression expression, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    Expression expression
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IAsyncEnumerable<TResult>>
    Type Parameters
    Name Description
    TResult
    | Improve this Doc View Source

    ITableMutable<T>.ChangeDatabaseName(Nullable<String>)

    Declaration
    ITable<T> ITableMutable<T>.ChangeDatabaseName(string? databaseName)
    Parameters
    Type Name Description
    System.Nullable<System.String> databaseName
    Returns
    Type Description
    ITable<T>
    | Improve this Doc View Source

    ITableMutable<T>.ChangeSchemaName(Nullable<String>)

    Declaration
    ITable<T> ITableMutable<T>.ChangeSchemaName(string? schemaName)
    Parameters
    Type Name Description
    System.Nullable<System.String> schemaName
    Returns
    Type Description
    ITable<T>
    | Improve this Doc View Source

    ITableMutable<T>.ChangeServerName(Nullable<String>)

    Declaration
    ITable<T> ITableMutable<T>.ChangeServerName(string? serverName)
    Parameters
    Type Name Description
    System.Nullable<System.String> serverName
    Returns
    Type Description
    ITable<T>
    | Improve this Doc View Source

    ITableMutable<T>.ChangeTableID(Nullable<String>)

    Declaration
    ITable<T> ITableMutable<T>.ChangeTableID(string? tableID)
    Parameters
    Type Name Description
    System.Nullable<System.String> tableID
    Returns
    Type Description
    ITable<T>
    | Improve this Doc View Source

    ITableMutable<T>.ChangeTableName(String)

    Declaration
    ITable<T> ITableMutable<T>.ChangeTableName(string tableName)
    Parameters
    Type Name Description
    System.String tableName
    Returns
    Type Description
    ITable<T>
    | Improve this Doc View Source

    ITableMutable<T>.ChangeTableOptions(TableOptions)

    Declaration
    ITable<T> ITableMutable<T>.ChangeTableOptions(TableOptions options)
    Parameters
    Type Name Description
    TableOptions options
    Returns
    Type Description
    ITable<T>
    | Improve this Doc View Source

    IExpressionQuery.Expression

    Declaration
    Expression IExpressionQuery.Expression { get; }
    Returns
    Type Description
    Expression
    | Improve this Doc View Source

    IExpressionQuery.SqlText

    Declaration
    string IExpressionQuery.SqlText { get; }
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    IExpressionQuery<T>.Expression

    Declaration
    Expression IExpressionQuery<T>.Expression { get; set; }
    Returns
    Type Description
    Expression

    Implements

    ITable<T>
    IExpressionQuery<T>
    IOrderedQueryable<>
    IQueryProviderAsync
    IQueryProvider
    IExpressionQuery
    ITableMutable<T>
    IDisposable
    IAsyncDisposable

    Extension Methods

    Map.DeepCopy<T>(T)
    Sql.IsDistinctFrom<T>(T, T)
    Sql.IsNotDistinctFrom<T>(T, T)
    SqlExtensions.In<T>(T, IEnumerable<T>)
    SqlExtensions.In<T>(T, IQueryable<T>)
    SqlExtensions.In<T>(T, T[])
    SqlExtensions.In<T>(T, T, T)
    SqlExtensions.In<T>(T, T, T, T)
    SqlExtensions.NotIn<T>(T, IEnumerable<T>)
    SqlExtensions.NotIn<T>(T, IQueryable<T>)
    SqlExtensions.NotIn<T>(T, T[])
    SqlExtensions.NotIn<T>(T, T, T)
    SqlExtensions.NotIn<T>(T, T, T, T)
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2011-2022 linq2db.com

    Generated by DocFX