Skip to content

Commit

Permalink
SqlCommand must be associated with tx manually (but not SqliteCommand)
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelGerr committed Jan 22, 2025
1 parent e4c032b commit 20e2993
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<PropertyGroup>
<Copyright>(c) $([System.DateTime]::Now.Year), Pawel Gerr. All rights reserved.</Copyright>
<VersionPrefix>9.2.0</VersionPrefix>
<Authors>Pawel Gerr</Authors>
<VersionPrefix>9.2.1</VersionPrefix>
<Authors>Pawel Gerr</Authors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageProjectUrl>https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore</PackageProjectUrl>
<PackageIcon>icon.png</PackageIcon>
Expand All @@ -12,7 +12,7 @@
<RepositoryUrl>https://[email protected]/pawelgerr/Thinktecture.EntityFrameworkCore/_git/Thinktecture.EntityFrameworkCore</RepositoryUrl>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<RootNamespace>Thinktecture</RootNamespace>
<TargetFrameworks>net8.0;net9.0;</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;</TargetFrameworks>
<LangVersion>13.0</LangVersion>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);CA1303;MSB3884;</NoWarn>
Expand All @@ -22,7 +22,7 @@
<VSTestLogger>trx%3bLogFileName=$(MSBuildProjectName).trx</VSTestLogger>
<VSTestResultsDirectory>$(MSBuildThisFileDirectory)test-results/$(TargetFramework)</VSTestResultsDirectory>
</PropertyGroup>

<ItemGroup>
<Using Include="Microsoft.EntityFrameworkCore" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Data;
using System.Data.Common;
using System.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage;
Expand Down Expand Up @@ -121,6 +120,7 @@ public async ValueTask DisposeAsync()
return null;

command = connection.CreateCommand();
command.Transaction = _database.CurrentTransaction?.GetDbTransaction();
command.CommandText = $"""
IF(OBJECT_ID('tempdb..{Name}') IS NOT NULL)
DROP TABLE {_sqlGenerationHelper.DelimitIdentifier(Name)};
Expand Down

0 comments on commit 20e2993

Please sign in to comment.