Skip to content

Commit

Permalink
Merge pull request #288 from phnx47/fix/clear-filterdata
Browse files Browse the repository at this point in the history
fix: cleanup filterdata.ordered
  • Loading branch information
phnx47 committed Jul 3, 2023
2 parents c665b9e + 86fee38 commit e77ecb1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
7 changes: 1 addition & 6 deletions src/DbContext/DapperDbContext.cs
Expand Up @@ -2,7 +2,6 @@

namespace MicroOrm.Dapper.Repositories.DbContext;


public class DapperDbContext : IDapperDbContext
{
/// <summary>
Expand All @@ -18,7 +17,6 @@ protected DapperDbContext(IDbConnection connection)
InnerConnection = connection;
}


public virtual IDbConnection Connection
{
get
Expand All @@ -28,26 +26,23 @@ public virtual IDbConnection Connection
}
}


public void OpenConnection()
{
if (InnerConnection.State != ConnectionState.Open && InnerConnection.State != ConnectionState.Connecting)
InnerConnection.Open();
}


public virtual IDbTransaction BeginTransaction()
{
return Connection.BeginTransaction();
}


/// <summary>
/// Close DB connection
/// </summary>
public void Dispose()
{
if (InnerConnection != null && InnerConnection.State != ConnectionState.Closed)
if (InnerConnection.State != ConnectionState.Closed)
InnerConnection.Close();
}
}
2 changes: 1 addition & 1 deletion src/MicroOrm.Dapper.Repositories.csproj
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<Description>CRUD for Dapper</Description>
<Copyright>2015 © Serge K</Copyright>
<VersionPrefix>1.25.0</VersionPrefix>
<VersionPrefix>1.25.1</VersionPrefix>
<Authors>Serge K and Contributors</Authors>
<TargetFrameworks>net461;netstandard2.0;net5.0</TargetFrameworks>
<LangVersion>11.0</LangVersion>
Expand Down
10 changes: 9 additions & 1 deletion src/ReadOnlyDapperRepository.cs
Expand Up @@ -68,9 +68,17 @@ public void Dispose()
{
_connection?.Dispose();
_connection = null;

if (_filterData == null)
return;
_filterData.LimitInfo = null;

_filterData.Ordered = false;

if (_filterData.LimitInfo != null)
{
_filterData.LimitInfo = null;
}

if (_filterData.OrderInfo != null)
{
_filterData.OrderInfo.Columns?.Clear();
Expand Down
2 changes: 2 additions & 0 deletions src/SqlGenerator/Filters/OrderInfo.cs
@@ -1,5 +1,7 @@
using System.Collections.Generic;

// ReSharper disable InconsistentNaming

namespace MicroOrm.Dapper.Repositories.SqlGenerator.Filters;

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/SqlGenerator/Filters/SelectInfo.cs
Expand Up @@ -3,7 +3,7 @@
namespace MicroOrm.Dapper.Repositories.SqlGenerator.Filters;

/// <summary>
///
/// Select Info
/// </summary>
public class SelectInfo
{
Expand Down

0 comments on commit e77ecb1

Please sign in to comment.