Skip to content

Commit 8f9839b

Browse files
committed
fix a bug when creating non-inmemory table if does not exist
1 parent da62449 commit 8f9839b

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/SQLAsyncOutputCacheProvider/SQLHelper.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Collections.Specialized;
55
using System.Configuration;
66
using System.Data.SqlClient;
7+
using System.Data;
78

89
class SQLHelper {
910
#region Private fields
@@ -43,15 +44,13 @@ PRIMARY KEY NONCLUSTERED
4344
public SQLHelper(NameValueCollection config) {
4445
ConnectionStringInfo = new ConnectionStringSettings(config["connectionStringName"], ConfigurationManager.ConnectionStrings[config["connectionStringName"]].ConnectionString);
4546
var useInMemoryTable = false;
46-
if (config[InMemoryTableConfigurationName] != null) {
47-
if (bool.TryParse(config[InMemoryTableConfigurationName], out useInMemoryTable) && useInMemoryTable) {
48-
CreatTableIfNotExists(CreateInMemoryOutputCacheTableSql);
49-
}
50-
else {
51-
CreatTableIfNotExists(CreateOutputCacheTableSql);
52-
}
53-
config.Remove(InMemoryTableConfigurationName);
47+
if (bool.TryParse(config[InMemoryTableConfigurationName], out useInMemoryTable) && useInMemoryTable) {
48+
CreatTableIfNotExists(CreateInMemoryOutputCacheTableSql);
49+
}
50+
else {
51+
CreatTableIfNotExists(CreateOutputCacheTableSql);
5452
}
53+
config.Remove(InMemoryTableConfigurationName);
5554
}
5655
#endregion
5756

0 commit comments

Comments
 (0)