Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit fb28b58

Browse files
committed
Add OpenDbConnectionAsync + exclude 'Security' schema from MSSQL Meta APIs
1 parent 7ebe1da commit fb28b58

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/ServiceStack.OrmLite.SqlServer/SqlServerOrmLiteDialectProvider.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ public override bool DoesTableExist(IDbCommand dbCmd, string tableName, string s
129129

130130
if (schema != null)
131131
sql += " AND TABLE_SCHEMA = {0}".SqlFmt(this, schema);
132+
else
133+
sql += " AND TABLE_SCHEMA <> 'Security'";
132134

133135
var result = dbCmd.ExecLongScalar(sql);
134136

tests/ServiceStack.OrmLite.Tests/OrmLiteTestBase.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Data;
33
using System.Data.Common;
44
using System.IO;
5+
using System.Threading.Tasks;
56
using NUnit.Framework;
67
using ServiceStack.Logging;
78
#if !NETCORE
@@ -197,6 +198,21 @@ public virtual IDbConnection OpenDbConnection()
197198
return DbFactory.OpenDbConnection();
198199
}
199200

201+
public virtual Task<IDbConnection> OpenDbConnectionAsync()
202+
{
203+
if (ConnectionString == ":memory:")
204+
{
205+
if (InMemoryDbConnection == null || DbFactory.AutoDisposeConnection)
206+
{
207+
InMemoryDbConnection = new OrmLiteConnection(DbFactory);
208+
InMemoryDbConnection.Open();
209+
}
210+
return Task.FromResult(InMemoryDbConnection);
211+
}
212+
213+
return DbFactory.OpenDbConnectionAsync();
214+
}
215+
200216
protected void SuppressIfOracle(string reason, params object[] args)
201217
{
202218
// Not Oracle if this base class used

0 commit comments

Comments
 (0)