Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ protected RelationalOptionsExtension(RelationalOptionsExtension copyFrom)
_useRelationalNulls = copyFrom._useRelationalNulls;
_querySplittingBehavior = copyFrom._querySplittingBehavior;
_migrationsAssembly = copyFrom._migrationsAssembly;
_migrationsAssemblyObject = copyFrom._migrationsAssemblyObject;
_migrationsHistoryTableName = copyFrom._migrationsHistoryTableName;
_migrationsHistoryTableSchema = copyFrom._migrationsHistoryTableSchema;
_executionStrategyFactory = copyFrom._executionStrategyFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Reflection;
using Microsoft.EntityFrameworkCore.TestUtilities.FakeProvider;

// ReSharper disable InconsistentNaming
Expand Down Expand Up @@ -94,4 +95,25 @@ public void Throws_if_MinBatchSize_out_of_range()
RelationalStrings.InvalidMinBatchSize(-1),
Assert.Throws<InvalidOperationException>(
() => new FakeRelationalOptionsExtension().WithMinBatchSize(-1)).Message);

[ConditionalFact]
public void MigrationsAssemblyObject_is_preserved_after_cloning()
{
var optionsExtension = new FakeRelationalOptionsExtension();

// Get the current executing assembly
var assembly = Assembly.GetExecutingAssembly();

// Set the migrations assembly
optionsExtension = (FakeRelationalOptionsExtension)optionsExtension.WithMigrationsAssembly(assembly);

// Verify the migrations assembly object is set
Assert.Same(assembly, optionsExtension.MigrationsAssemblyObject);

// Clone the options by using another With method (which internally calls Clone())
optionsExtension = (FakeRelationalOptionsExtension)optionsExtension.WithCommandTimeout(100);

// Verify the migrations assembly object is still preserved after cloning
Assert.Same(assembly, optionsExtension.MigrationsAssemblyObject);
}
}