Skip to content

Commit

Permalink
Resharper cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jas88 committed Dec 21, 2023
1 parent 26403a1 commit 043e4fd
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
6 changes: 3 additions & 3 deletions FAnsiSql/Connections/ManagedConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ namespace FAnsi.Connections;
public sealed class ManagedConnection : IManagedConnection
{
/// <inheritdoc/>
public DbConnection Connection { get; private set; }
public DbConnection Connection { get; }

/// <inheritdoc/>
public DbTransaction Transaction { get; private set; }
public DbTransaction Transaction { get; }

/// <inheritdoc/>
public IManagedTransaction ManagedTransaction { get; private set; }
public IManagedTransaction ManagedTransaction { get; }

/// <inheritdoc/>
public bool CloseOnDispose { get; set; }
Expand Down
14 changes: 7 additions & 7 deletions FAnsiSql/Connections/ManagedTransaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ namespace FAnsi.Connections;
public sealed class ManagedTransaction : IManagedTransaction
{
/// <inheritdoc/>
public DbConnection Connection { get; private set; }
public DbConnection Connection { get; }

/// <inheritdoc/>
public DbTransaction Transaction { get; private set; }
public DbTransaction Transaction { get; }

internal ManagedTransaction(DbConnection connection, DbTransaction transaction)
{
Connection = connection;
Transaction = transaction;
}

private bool closed;
private bool _closed;

/// <summary>
/// Attempts to rollback the DbTransaction (swallowing any Exception) and closes/disposes the DbConnection
/// </summary>
public void AbandonAndCloseConnection()
{
if(closed)
if(_closed)
return;

closed = true;
_closed = true;

try
{
Expand All @@ -51,10 +51,10 @@ public void AbandonAndCloseConnection()
/// </summary>
public void CommitAndCloseConnection()
{
if(closed)
if(_closed)
return;

closed = true;
_closed = true;

try
{
Expand Down
5 changes: 2 additions & 3 deletions FAnsiSql/Discovery/Constraints/DiscoveredRelationship.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public sealed class DiscoveredRelationship(string fkName, DiscoveredTable pkTabl
/// <summary>
/// The table in which the primary key is declared. This is the parent table.
/// </summary>
public DiscoveredTable PrimaryKeyTable { get; private set; } = pkTable;
public DiscoveredTable PrimaryKeyTable { get; } = pkTable;

/// <summary>
/// The table which contains child records.
/// </summary>
public DiscoveredTable ForeignKeyTable { get; private set; } = fkTable;
public DiscoveredTable ForeignKeyTable { get; } = fkTable;

/// <summary>
/// Mapping of primary key column(s) in <see cref="PrimaryKeyTable"/> to foreign key column(s) in <see cref="ForeignKeyTable"/>. If there are more than one entry
Expand Down Expand Up @@ -64,6 +64,5 @@ public void AddKeys(string primaryKeyCol, string foreignKeyCol,IManagedTransacti
_pkColumns.Single(c=>c.GetRuntimeName().Equals(primaryKeyCol,StringComparison.CurrentCultureIgnoreCase)),
_fkColumns.Single(c => c.GetRuntimeName().Equals(foreignKeyCol, StringComparison.CurrentCultureIgnoreCase))
);

}
}
6 changes: 3 additions & 3 deletions FAnsiSql/Discovery/DiscoveredDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ namespace FAnsi.Discovery;
/// <summary>
/// Cross database type reference to a specific database on a database server. Allows you to create tables, drop check existance etc.
/// </summary>
public sealed class DiscoveredDatabase :IHasRuntimeName,IMightNotExist
public sealed class DiscoveredDatabase : IHasRuntimeName, IMightNotExist
{
private readonly string _database;
private readonly IQuerySyntaxHelper _querySyntaxHelper;

/// <summary>
/// The server on which the database exists
/// </summary>
public DiscoveredServer Server { get; private set; }
public DiscoveredServer Server { get; }

/// <summary>
/// Stateless helper class with DBMS specific implementation of the logic required by <see cref="DiscoveredDatabase"/>.
/// </summary>
public IDiscoveredDatabaseHelper Helper { get; private set; }
public IDiscoveredDatabaseHelper Helper { get; }

/// <summary>
/// API constructor, instead use <see cref="DiscoveredServer.ExpectDatabase"/> instead.
Expand Down
4 changes: 2 additions & 2 deletions FAnsiSql/Discovery/QuerySyntax/TopXResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
/// </summary>
public sealed class TopXResponse(string sql, QueryComponent location)
{
public string SQL { get; set; } = sql;
public QueryComponent Location { get; set; } = location;
public string SQL { get; } = sql;
public QueryComponent Location { get; } = location;
}

0 comments on commit 043e4fd

Please sign in to comment.