File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
src/EFCore.Relational/Infrastructure
test/EFCore.Relational.Tests/Infrastructure Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ protected RelationalOptionsExtension(RelationalOptionsExtension copyFrom)
61
61
_useRelationalNulls = copyFrom . _useRelationalNulls ;
62
62
_querySplittingBehavior = copyFrom . _querySplittingBehavior ;
63
63
_migrationsAssembly = copyFrom . _migrationsAssembly ;
64
+ _migrationsAssemblyObject = copyFrom . _migrationsAssemblyObject ;
64
65
_migrationsHistoryTableName = copyFrom . _migrationsHistoryTableName ;
65
66
_migrationsHistoryTableSchema = copyFrom . _migrationsHistoryTableSchema ;
66
67
_executionStrategyFactory = copyFrom . _executionStrategyFactory ;
Original file line number Diff line number Diff line change 1
1
// Licensed to the .NET Foundation under one or more agreements.
2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
4
+ using System . Reflection ;
4
5
using Microsoft . EntityFrameworkCore . TestUtilities . FakeProvider ;
5
6
6
7
// ReSharper disable InconsistentNaming
@@ -94,4 +95,25 @@ public void Throws_if_MinBatchSize_out_of_range()
94
95
RelationalStrings . InvalidMinBatchSize ( - 1 ) ,
95
96
Assert . Throws < InvalidOperationException > (
96
97
( ) => new FakeRelationalOptionsExtension ( ) . WithMinBatchSize ( - 1 ) ) . Message ) ;
98
+
99
+ [ ConditionalFact ]
100
+ public void MigrationsAssemblyObject_is_preserved_after_cloning ( )
101
+ {
102
+ var optionsExtension = new FakeRelationalOptionsExtension ( ) ;
103
+
104
+ // Get the current executing assembly
105
+ var assembly = Assembly . GetExecutingAssembly ( ) ;
106
+
107
+ // Set the migrations assembly
108
+ optionsExtension = ( FakeRelationalOptionsExtension ) optionsExtension . WithMigrationsAssembly ( assembly ) ;
109
+
110
+ // Verify the migrations assembly object is set
111
+ Assert . Same ( assembly , optionsExtension . MigrationsAssemblyObject ) ;
112
+
113
+ // Clone the options by using another With method (which internally calls Clone())
114
+ optionsExtension = ( FakeRelationalOptionsExtension ) optionsExtension . WithCommandTimeout ( 100 ) ;
115
+
116
+ // Verify the migrations assembly object is still preserved after cloning
117
+ Assert . Same ( assembly , optionsExtension . MigrationsAssemblyObject ) ;
118
+ }
97
119
}
You can’t perform that action at this time.
0 commit comments