Skip to content

Commit

Permalink
Stop using System.Transactions in MismatchedKeyTypesSqlServerTest (#3…
Browse files Browse the repository at this point in the history
…2886)

Since this is the primary source of #29054
  • Loading branch information
ajcvickers committed Jan 22, 2024
1 parent f80b6c5 commit dba3a12
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

#nullable enable

using System.Transactions;

namespace Microsoft.EntityFrameworkCore.Update;

public class MismatchedKeyTypesSqlServerTest(MismatchedKeyTypesSqlServerTest.MismatchedKeyTypesSqlServerFixture fixture) : IClassFixture<MismatchedKeyTypesSqlServerTest.MismatchedKeyTypesSqlServerFixture>
Expand All @@ -14,8 +12,8 @@ public class MismatchedKeyTypesSqlServerTest(MismatchedKeyTypesSqlServerTest.Mis
[ConditionalFact] // Issue #28392
public virtual void Can_update_and_delete_with_bigint_FK_and_int_PK()
{
using var _ = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled);
using var context = new MismatchedKeyTypesContext(Fixture);
context.Database.BeginTransaction();

var principalEmpty = LoadAndValidateEmpty();
var principalPopulated = LoadAndValidatePopulated(2);
Expand Down Expand Up @@ -87,8 +85,8 @@ IQueryable<PrincipalIntLong> Load()
[ConditionalFact] // Issue #28392
public virtual void Can_update_and_delete_with_tinyint_FK_and_smallint_PK()
{
using var _ = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled);
using var context = new MismatchedKeyTypesContext(Fixture);
context.Database.BeginTransaction();

var principalEmpty = LoadAndValidateEmpty();
var principalPopulated = LoadAndValidatePopulated(2);
Expand Down Expand Up @@ -160,8 +158,8 @@ IQueryable<PrincipalShortByte> Load()
[ConditionalFact] // Issue #28392
public virtual void Can_update_and_delete_with_string_FK_and_GUID_PK()
{
using var _ = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled);
using var context = new MismatchedKeyTypesContext(Fixture);
context.Database.BeginTransaction();

var principalEmpty = LoadAndValidateEmpty();
var principalPopulated = LoadAndValidatePopulated(2);
Expand Down Expand Up @@ -233,8 +231,8 @@ IQueryable<PrincipalStringGuid> Load()
[ConditionalFact] // Issue #28392
public virtual void Can_update_and_delete_composite_keys_mismatched_in_store()
{
using var _ = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled);
using var context = new MismatchedKeyTypesContext(Fixture);
context.Database.BeginTransaction();

var principalEmpty = LoadAndValidateEmpty();
var principalPopulated = LoadAndValidatePopulated(2);
Expand Down Expand Up @@ -306,8 +304,8 @@ IQueryable<PrincipalComposite> Load()
[ConditionalFact]
public virtual void Queries_work_but_SaveChanges_fails_when_composite_keys_incompatible_in_store()
{
using var _ = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled);
using var context = new MismatchedKeyTypesContext(Fixture);
context.Database.BeginTransaction();

context.Database.ExecuteSqlRaw(
@"INSERT INTO PrincipalBadComposite (Id1, Id2, Id3)
Expand All @@ -334,8 +332,8 @@ public virtual void Queries_work_but_SaveChanges_fails_when_composite_keys_incom
[ConditionalFact]
public virtual void Queries_work_but_SaveChanges_fails_when_keys_incompatible_in_store()
{
using var _ = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled);
using var context = new MismatchedKeyTypesContext(Fixture);
context.Database.BeginTransaction();

context.Database.ExecuteSqlRaw(
@"INSERT INTO PrincipalBad (Id)
Expand Down

0 comments on commit dba3a12

Please sign in to comment.