* Move core dependencies and MSBuild targets from Umbraco.Cms to Umbraco.Cms.Targets * Re-add appsettings.Tests.json * Include appsettings-schema.json * Use .NET 7.x in CodeQL build * Fix duplicate Directory.Build.props import * Decouple ImageSharp/ImageSharp.Web implementations * Further decouple SqlServer implementation * Add SupportedImageFileTypes to IImageDimensionExtractor * Update descriptions * Update project metadata * Re-enable package validation * Add embedded package icon * Move ContinuousIntegrationBuild to build script * Move shared properties to root Directory.Build.props * Fix GetInstallState throwing exception when default provider isn't configured * Remove redundant PackageRequireLicenseAcceptance and update version to 11.0.0-rc1 * Update build script * Remove LangVersion preview * Disable app-local ICU for MacOS integration test * Disable app-local ICU for all integration tests * Fix RuntimeState_Run test assertion * Update projects and build script to require Node.js 16.17 (latest LTS) * Remove app-local ICU from unit tests * Add missing project reference * Generate XML documentation files * Expose management API in Web.UI project * Update .NET 7 dependencies to RC1 * Update package-lock.json files * Downgrade Cypress version
30 lines
1.4 KiB
C#
30 lines
1.4 KiB
C#
using Microsoft.Data.SqlClient;
|
|
using NPoco;
|
|
using NPoco.SqlServer;
|
|
using Umbraco.Extensions;
|
|
|
|
namespace Umbraco.Cms.Persistence.SqlServer;
|
|
|
|
public static class NPocoSqlServerDatabaseExtensions
|
|
{
|
|
/// <summary>
|
|
/// Configures NPoco's SqlBulkCopyHelper to use the correct SqlConnection and SqlTransaction instances from the
|
|
/// underlying RetryDbConnection and ProfiledDbTransaction
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// This is required to use NPoco's own <see cref="Database.InsertBulk{T}(IEnumerable{T})" /> method because we use
|
|
/// wrapped DbConnection and DbTransaction instances.
|
|
/// NPoco's InsertBulk method only caters for efficient bulk inserting records for Sql Server, it does not cater for
|
|
/// bulk inserting of records for
|
|
/// any other database type and in which case will just insert records one at a time.
|
|
/// NPoco's InsertBulk method also deals with updating the passed in entity's PK/ID once it's inserted whereas our own
|
|
/// BulkInsertRecords methods
|
|
/// do not handle this scenario.
|
|
/// </remarks>
|
|
public static void ConfigureNPocoBulkExtensions()
|
|
{
|
|
SqlBulkCopyHelper.SqlConnectionResolver = NPocoDatabaseExtensions.GetTypedConnection<SqlConnection>;
|
|
SqlBulkCopyHelper.SqlTransactionResolver = NPocoDatabaseExtensions.GetTypedTransaction<SqlTransaction>;
|
|
}
|
|
}
|