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

Commit 709a5df

Browse files
committed
Assert dbCmd is still open when returning IDbCommand
1 parent cce38f6 commit 709a5df

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/ServiceStack.OrmLite.MySql.Tests/CustomSqlTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public void Can_execute_stored_procedure_using_SqlProc_with_out_params()
6161
db.ExecuteSql(spSql);
6262

6363
var cmd = db.SqlProc("spSearchLetters", new { pLetter = "C" });
64+
65+
Assert.That(((OrmLiteCommand)cmd).IsDisposed, Is.False);
66+
6467
var pTotal = cmd.AddParam("pTotal", direction: ParameterDirection.Output);
6568
var results = cmd.ConvertToList<LetterFrequency>();
6669

src/ServiceStack.OrmLite/OrmLiteCommand.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class OrmLiteCommand : IDbCommand, IHasDbCommand
1212
private OrmLiteConnection dbConn;
1313
private IDbCommand dbCmd;
1414
public IOrmLiteDialectProvider DialectProvider;
15+
public bool IsDisposed { get; private set; }
1516

1617
public OrmLiteCommand(OrmLiteConnection dbConn, IDbCommand dbCmd)
1718
{
@@ -22,6 +23,7 @@ public OrmLiteCommand(OrmLiteConnection dbConn, IDbCommand dbCmd)
2223

2324
public void Dispose()
2425
{
26+
IsDisposed = true;
2527
dbCmd.Dispose();
2628
}
2729

0 commit comments

Comments
 (0)