Skip to content

Commit 3e6aa05

Browse files
committed
修复数据库无法连接的时候,codefirst的HasData会导致SyncStructure迁移死循环调用,然后Stackoverflow异常 #2082
1 parent 819251c commit 3e6aa05

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

FreeSql.DbContext/EfCoreFluentApi/EfCoreTableFluent`1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,11 @@ public EfCoreTableFluent<T> HasData(IEnumerable<T> data)
340340
var sdCopyLock = new object();
341341
_fsql.Aop.SyncStructureAfter += new EventHandler<Aop.SyncStructureAfterEventArgs>((s, e) =>
342342
{
343+
if (e.Exception != null) return;
343344
object[] sd = null;
344345
lock (sdCopyLock)
345346
sd = sdCopy?.ToArray();
346347
if (sd == null || sd.Any() == false) return;
347-
if (e.Exception != null) return;
348348
foreach (var et in e.EntityTypes)
349349
{
350350
if (et != typeof(T)) continue;

0 commit comments

Comments
 (0)