Data/CafeLib.Data.Sources.SqlServer/SqlServerCommandProvider.cs
/// <summary>
/// Insert or update an entity record.
/// </summary>
/// <typeparam name="TEntity">The type being inserted.</typeparam>
/// <param name="connectionInfo">Connection info</param>
/// <param name="data">Entity record</param>
/// <param name="expressions"></param>
/// <param name="token">Cancellation token</param>
/// <returns></returns>
Insert or update an entity record.
Insert or update an entity record .
public async Task<int> UpsertAsync<TEntity>(IConnectionInfo connectionInfo, IEnumerable<TEntity> data, Expression<Func<TEntity, object>>[] expressions, CancellationToken token = default) where TEntity : class, IEntity
        {
            await using var connection = connectionInfo.GetConnection<SqlConnection>();
            return await connection.BulkMergeAsync(data, cancellationToken: token).ConfigureAwait(false);
        }
public async Task < int > UpsertAsync < TEntity > ( IConnectionInfo connectionInfo , IEnumerable < TEntity > data , Expression < Func < TEntity , object > > [ ] expressions , CancellationToken token = default ) where TEntity : class , IEntity { await using var connection = connectionInfo . GetConnection < SqlConnection > ( ) ; return await connection . BulkMergeAsync ( data , cancellationToken : token ) . ConfigureAwait ( false ) ; }
Insert or update an entity record.
Insert or update an entity record .
None
connectionInfo
IConnectionInfo
None
data
IEnumerable<TEntity>
None
expressions
Expression<Func<TEntity, object>>[]
None
token
CancellationToken
None
typeparam
The type being inserted.
The type being inserted .