// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.TestModels.ManyToManyModel; using Microsoft.EntityFrameworkCore.TestUtilities; namespace EntityFrameworkCore.Jet.FunctionalTests; public abstract class ManyToManyTrackingJetTestBase(TFixture fixture) : ManyToManyTrackingRelationalTestBase(fixture) where TFixture : ManyToManyTrackingJetTestBase.ManyToManyTrackingJetFixtureBase { protected override Dictionary CustomDeleteBehaviors { get; } = new() { { "EntityBranch.RootSkipShared", DeleteBehavior.ClientCascade }, { "EntityBranch2.Leaf2SkipShared", DeleteBehavior.ClientCascade }, { "EntityBranch2.SelfSkipSharedLeft", DeleteBehavior.ClientCascade }, { "EntityOne.SelfSkipPayloadLeft", DeleteBehavior.ClientCascade }, { "EntityTableSharing1.TableSharing2Shared", DeleteBehavior.ClientCascade }, { "EntityTwo.SelfSkipSharedLeft", DeleteBehavior.ClientCascade }, { "UnidirectionalEntityBranch.UnidirectionalEntityRoot", DeleteBehavior.ClientCascade }, { "UnidirectionalEntityOne.SelfSkipPayloadLeft", DeleteBehavior.ClientCascade }, { "UnidirectionalEntityTwo.SelfSkipSharedRight", DeleteBehavior.ClientCascade }, }; public class ManyToManyTrackingJetFixtureBase : ManyToManyTrackingRelationalFixture, ITestSqlLoggerFactory { public TestSqlLoggerFactory TestSqlLoggerFactory => (TestSqlLoggerFactory)ListLoggerFactory; protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { base.OnModelCreating(modelBuilder, context); modelBuilder .Entity() .Property(e => e.Payload) .HasDefaultValueSql("DATE()"); modelBuilder .SharedTypeEntity>("JoinOneToThreePayloadFullShared") .IndexerProperty("Payload") .HasDefaultValue("Generated"); modelBuilder .Entity() .Property(e => e.Payload) .HasDefaultValue("Generated"); modelBuilder .Entity() .Property(e => e.Payload) .HasDefaultValueSql("DATE()"); modelBuilder .SharedTypeEntity>("UnidirectionalJoinOneToThreePayloadFullShared") .IndexerProperty("Payload") .HasDefaultValue("Generated"); modelBuilder .Entity() .Property(e => e.Payload) .HasDefaultValue("Generated"); } } }