Skip to content

Commit 241894e

Browse files
committed
graph updates complex foreign key fixes
1 parent 42ec830 commit 241894e

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

src/EFCore.Jet.Data/JetDataReader.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,5 +544,17 @@ public override T GetFieldValue<T>(int ordinal)
544544

545545
return (T)GetValue(ordinal);
546546
}
547+
548+
protected override void Dispose(bool disposing)
549+
{
550+
if (disposing)
551+
{
552+
_wrappedDataReader.Dispose();
553+
}
554+
#if DEBUG
555+
Interlocked.Decrement(ref _activeObjectsCount);
556+
#endif
557+
base.Dispose(disposing);
558+
}
547559
}
548560
}

test/EFCore.Jet.FunctionalTests/GraphUpdates/GraphUpdatesJetTestBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ protected override async Task SeedAsync(PoolableDbContext context)
230230
await context.Database.ExecuteSqlAsync($"ALTER TABLE `OwnedOptional2` DROP CONSTRAINT `FK_OwnedOptional2_OwnedOptional1_OwnedOptional1OwnerRootId_Owne~`");
231231
await context.Database.ExecuteSqlAsync($"ALTER TABLE `OwnedRequired2` DROP CONSTRAINT `FK_OwnedRequired2_OwnedRequired1_OwnedRequired1OwnerRootId_Owne~`");
232232
await context.Database.ExecuteSqlAsync($"ALTER TABLE `RequiredComposite2` DROP CONSTRAINT `FK_RequiredComposite2_RequiredAk1_ParentId_ParentAlternateId`");
233+
await context.Database.ExecuteSqlAsync($"ALTER TABLE `SharedFkParent` DROP CONSTRAINT `FK_SharedFkParent_SharedFkDependant_RootId_DependantId`");
233234
}
234235
}
235236
}

test/EFCore.Jet.FunctionalTests/GraphUpdates/ProxyGraphUpdatesJetTest.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,16 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
3232
modelBuilder.Entity<SharedFkParent>().Property(x => x.Id).HasColumnType("int");
3333
}
3434

35-
protected override Task SeedAsync(DbContext context)
35+
protected override async Task SeedAsync(DbContext context)
3636
{
3737
//context.Database.ExecuteSql($"ALTER TABLE `SharedFkDependant` DROP CONSTRAINT `AK_SharedFkDependant_RootId_Id`");
38-
return base.SeedAsync(context);
38+
await base.SeedAsync(context);
39+
40+
await context.Database.ExecuteSqlAsync($"ALTER TABLE `OptionalComposite2` DROP CONSTRAINT `FK_OptionalComposite2_OptionalAk1_ParentId_ParentAlternateId`");
41+
await context.Database.ExecuteSqlAsync($"ALTER TABLE `OptionalOverlapping2` DROP CONSTRAINT `FK_OptionalOverlapping2_RequiredComposite1_ParentId_ParentAlter~`");
42+
await context.Database.ExecuteSqlAsync($"ALTER TABLE `OptionalSingleComposite2` DROP CONSTRAINT `FK_OptionalSingleComposite2_OptionalSingleAk1_BackId_ParentAlte~`");
43+
await context.Database.ExecuteSqlAsync($"ALTER TABLE `RequiredComposite2` DROP CONSTRAINT `FK_RequiredComposite2_RequiredAk1_ParentId_ParentAlternateId`");
44+
await context.Database.ExecuteSqlAsync($"ALTER TABLE `SharedFkParent` DROP CONSTRAINT `FK_SharedFkParent_SharedFkDependant_RootId_DependantId`");
3945
}
4046
}
4147
}

0 commit comments

Comments
 (0)