You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.5 KiB
C#
42 lines
1.5 KiB
C#
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Storage;
|
|
using System.Linq;
|
|
|
|
namespace EntityFrameworkCore.Jet.FunctionalTests;
|
|
|
|
#nullable disable
|
|
|
|
public class GraphUpdatesJetClientCascadeTest(GraphUpdatesJetClientCascadeTest.JetFixture fixture)
|
|
: GraphUpdatesJetTestBase<
|
|
GraphUpdatesJetClientCascadeTest.JetFixture>(fixture)
|
|
{
|
|
protected override void UseTransaction(DatabaseFacade facade, IDbContextTransaction transaction)
|
|
=> facade.UseTransaction(transaction.GetDbTransaction());
|
|
|
|
public class JetFixture : GraphUpdatesJetFixtureBase
|
|
{
|
|
public override bool NoStoreCascades
|
|
=> true;
|
|
|
|
protected override string StoreName
|
|
=> "GraphClientCascadeUpdatesTest";
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
|
|
{
|
|
base.OnModelCreating(modelBuilder, context);
|
|
|
|
foreach (var foreignKey in modelBuilder.Model
|
|
.GetEntityTypes()
|
|
.SelectMany(e => e.GetDeclaredForeignKeys())
|
|
.Where(e => e.DeleteBehavior == DeleteBehavior.Cascade))
|
|
{
|
|
foreignKey.DeleteBehavior = DeleteBehavior.ClientCascade;
|
|
}
|
|
}
|
|
}
|
|
}
|