From 1b2ea363a907fa3d4a2e58054016314b1be58c82 Mon Sep 17 00:00:00 2001 From: "610262374@qq.com" <610262374@qq.com> Date: Sat, 24 Nov 2018 01:59:34 +0800 Subject: [PATCH] https://github.com/sunkaixuan/SqlSugar/issues/149 --- Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs index 6451ebc8a..3066e6956 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs @@ -110,11 +110,14 @@ namespace SqlSugar if (this.IsMasterSlaveSeparation) { - foreach (var slaveConnection in this.SlaveConnections) + if (this.SlaveConnections != null) { - if (slaveConnection != null && slaveConnection.State == ConnectionState.Open) + foreach (var slaveConnection in this.SlaveConnections) { - slaveConnection.Dispose(); + if (slaveConnection != null && slaveConnection.State == ConnectionState.Open) + { + slaveConnection.Dispose(); + } } } }