Skip to content

Commit 81ebbe3

Browse files
committed
chore(format): apply .editorconfig fixes
1 parent 244cba0 commit 81ebbe3

21 files changed

+129
-255
lines changed

src/KeelMatrix.QueryWatch/Ado/QueryWatchCommand.cs

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,40 @@
44
using System.Diagnostics;
55
using System.Diagnostics.CodeAnalysis;
66

7-
namespace KeelMatrix.QueryWatch.Ado
8-
{
7+
namespace KeelMatrix.QueryWatch.Ado {
98
/// <summary>
109
/// Delegating <see cref="DbCommand"/> that measures execution and records into a session.
1110
/// </summary>
12-
public sealed class QueryWatchCommand : DbCommand
13-
{
11+
public sealed class QueryWatchCommand : DbCommand {
1412
private readonly DbCommand _inner;
1513
private readonly QueryWatchSession _session;
1614
private readonly DbConnection? _connection; // wrapper connection
1715

18-
public QueryWatchCommand(DbCommand inner, QueryWatchSession session, DbConnection? wrapperConnection = null)
19-
{
16+
public QueryWatchCommand(DbCommand inner, QueryWatchSession session, DbConnection? wrapperConnection = null) {
2017
_inner = inner ?? throw new ArgumentNullException(nameof(inner));
2118
_session = session ?? throw new ArgumentNullException(nameof(session));
2219
_connection = wrapperConnection;
2320
}
2421

2522
[AllowNull]
26-
public override string CommandText
27-
{
23+
public override string CommandText {
2824
get => _inner.CommandText;
2925
set => _inner.CommandText = value;
3026
}
3127

32-
public override int CommandTimeout
33-
{
28+
public override int CommandTimeout {
3429
get => _inner.CommandTimeout;
3530
set => _inner.CommandTimeout = value;
3631
}
3732

38-
public override CommandType CommandType
39-
{
33+
public override CommandType CommandType {
4034
get => _inner.CommandType;
4135
set => _inner.CommandType = value;
4236
}
4337

44-
protected override DbConnection? DbConnection
45-
{
38+
protected override DbConnection? DbConnection {
4639
get => _connection ?? _inner.Connection;
47-
set
48-
{
40+
set {
4941
if (value is null) {
5042
_inner.Connection = null;
5143
}
@@ -60,20 +52,17 @@ protected override DbConnection? DbConnection
6052

6153
protected override DbParameterCollection DbParameterCollection => _inner.Parameters;
6254

63-
protected override DbTransaction? DbTransaction
64-
{
55+
protected override DbTransaction? DbTransaction {
6556
get => _inner.Transaction;
6657
set => _inner.Transaction = value;
6758
}
6859

69-
public override bool DesignTimeVisible
70-
{
60+
public override bool DesignTimeVisible {
7161
get => _inner.DesignTimeVisible;
7262
set => _inner.DesignTimeVisible = value;
7363
}
7464

75-
public override UpdateRowSource UpdatedRowSource
76-
{
65+
public override UpdateRowSource UpdatedRowSource {
7766
get => _inner.UpdatedRowSource;
7867
set => _inner.UpdatedRowSource = value;
7968
}
@@ -85,50 +74,43 @@ public override UpdateRowSource UpdatedRowSource
8574

8675
private void Record(TimeSpan elapsed) => _session.Record(_inner.CommandText ?? string.Empty, elapsed);
8776

88-
public override int ExecuteNonQuery()
89-
{
77+
public override int ExecuteNonQuery() {
9078
var sw = Stopwatch.StartNew();
9179
try { return _inner.ExecuteNonQuery(); }
9280
finally { sw.Stop(); Record(sw.Elapsed); }
9381
}
9482

95-
public override object? ExecuteScalar()
96-
{
83+
public override object? ExecuteScalar() {
9784
var sw = Stopwatch.StartNew();
9885
try { return _inner.ExecuteScalar(); }
9986
finally { sw.Stop(); Record(sw.Elapsed); }
10087
}
10188

102-
protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
103-
{
89+
protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior) {
10490
var sw = Stopwatch.StartNew();
10591
try { return _inner.ExecuteReader(behavior); }
10692
finally { sw.Stop(); Record(sw.Elapsed); }
10793
}
10894

109-
public override async Task<int> ExecuteNonQueryAsync(CancellationToken cancellationToken)
110-
{
95+
public override async Task<int> ExecuteNonQueryAsync(CancellationToken cancellationToken) {
11196
var sw = Stopwatch.StartNew();
11297
try { return await _inner.ExecuteNonQueryAsync(cancellationToken).ConfigureAwait(false); }
11398
finally { sw.Stop(); Record(sw.Elapsed); }
11499
}
115100

116-
public override async Task<object?> ExecuteScalarAsync(CancellationToken cancellationToken)
117-
{
101+
public override async Task<object?> ExecuteScalarAsync(CancellationToken cancellationToken) {
118102
var sw = Stopwatch.StartNew();
119103
try { return await _inner.ExecuteScalarAsync(cancellationToken).ConfigureAwait(false); }
120104
finally { sw.Stop(); Record(sw.Elapsed); }
121105
}
122106

123-
protected override async Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
124-
{
107+
protected override async Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) {
125108
var sw = Stopwatch.StartNew();
126109
try { return await _inner.ExecuteReaderAsync(behavior, cancellationToken).ConfigureAwait(false); }
127110
finally { sw.Stop(); Record(sw.Elapsed); }
128111
}
129112

130-
protected override void Dispose(bool disposing)
131-
{
113+
protected override void Dispose(bool disposing) {
132114
if (disposing) _inner.Dispose();
133115
base.Dispose(disposing);
134116
}

src/KeelMatrix.QueryWatch/Ado/QueryWatchConnection.cs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,16 @@
44
using System.Data.Common;
55
using System.Diagnostics.CodeAnalysis;
66

7-
namespace KeelMatrix.QueryWatch.Ado
8-
{
7+
namespace KeelMatrix.QueryWatch.Ado {
98
/// <summary>
109
/// Wraps a provider <see cref="DbConnection"/> and returns commands that record
1110
/// execution into a <see cref="QueryWatchSession"/>.
1211
/// </summary>
13-
public sealed class QueryWatchConnection : DbConnection
14-
{
12+
public sealed class QueryWatchConnection : DbConnection {
1513
private readonly DbConnection _inner;
1614
private readonly QueryWatchSession _session;
1715

18-
public QueryWatchConnection(DbConnection inner, QueryWatchSession session)
19-
{
16+
public QueryWatchConnection(DbConnection inner, QueryWatchSession session) {
2017
_inner = inner ?? throw new ArgumentNullException(nameof(inner));
2118
_session = session ?? throw new ArgumentNullException(nameof(session));
2219
}
@@ -25,8 +22,7 @@ public QueryWatchConnection(DbConnection inner, QueryWatchSession session)
2522
public DbConnection Inner => _inner;
2623

2724
[AllowNull]
28-
public override string ConnectionString
29-
{
25+
public override string ConnectionString {
3026
get => _inner.ConnectionString;
3127
set => _inner.ConnectionString = value;
3228
}
@@ -46,10 +42,8 @@ protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLeve
4642
protected override DbCommand CreateDbCommand()
4743
=> new QueryWatchCommand(_inner.CreateCommand(), _session, this);
4844

49-
protected override void Dispose(bool disposing)
50-
{
51-
if (disposing)
52-
{
45+
protected override void Dispose(bool disposing) {
46+
if (disposing) {
5347
_inner.Dispose();
5448
}
5549
base.Dispose(disposing);
@@ -59,17 +53,15 @@ protected override void Dispose(bool disposing)
5953
/// <summary>
6054
/// Convenience extensions to wrap existing connections.
6155
/// </summary>
62-
public static class QueryWatchConnectionExtensions
63-
{
56+
public static class QueryWatchConnectionExtensions {
6457
/// <summary>Wrap a <see cref="DbConnection"/>.</summary>
6558
public static DbConnection WithQueryWatch(this DbConnection connection, QueryWatchSession session)
6659
=> new QueryWatchConnection(connection, session);
6760

6861
/// <summary>
6962
/// Wrap an <see cref="IDbConnection"/> where the underlying type is a <see cref="DbConnection"/>.
7063
/// </summary>
71-
public static IDbConnection WithQueryWatch(this IDbConnection connection, QueryWatchSession session)
72-
{
64+
public static IDbConnection WithQueryWatch(this IDbConnection connection, QueryWatchSession session) {
7365
if (connection is DbConnection db) return new QueryWatchConnection(db, session);
7466
throw new NotSupportedException("This provider doesn't derive from DbConnection; wrap commands manually.");
7567
}

src/KeelMatrix.QueryWatch/EfCore/DbContextOptionsBuilderExtensions.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
#nullable enable
33
using Microsoft.EntityFrameworkCore;
44

5-
namespace KeelMatrix.QueryWatch.EfCore
6-
{
5+
namespace KeelMatrix.QueryWatch.EfCore {
76
/// <summary>
87
/// EF Core integration helpers for wiring QueryWatch into a DbContext.
98
/// </summary>
10-
public static class DbContextOptionsBuilderExtensions
11-
{
9+
public static class DbContextOptionsBuilderExtensions {
1210
// TODO: wierd characters in XML comments
1311

1412
/// <summary>
@@ -29,8 +27,7 @@ public static class DbContextOptionsBuilderExtensions
2927
/// </example>
3028
public static DbContextOptionsBuilder UseQueryWatch(
3129
this DbContextOptionsBuilder builder,
32-
QueryWatchSession session)
33-
{
30+
QueryWatchSession session) {
3431
builder.AddInterceptors(new EfCoreQueryWatchInterceptor(session));
3532
return builder;
3633
}

src/KeelMatrix.QueryWatch/EfCore/EfCoreQueryWatchInterceptor.cs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,18 @@
33
using System.Data.Common;
44
using Microsoft.EntityFrameworkCore.Diagnostics;
55

6-
namespace KeelMatrix.QueryWatch.EfCore
7-
{
6+
namespace KeelMatrix.QueryWatch.EfCore {
87
/// <summary>
98
/// EF Core DbCommand interceptor that records command durations into a <see cref="QueryWatchSession"/>.
109
/// </summary>
11-
public sealed class EfCoreQueryWatchInterceptor : DbCommandInterceptor
12-
{
10+
public sealed class EfCoreQueryWatchInterceptor : DbCommandInterceptor {
1311
private readonly QueryWatchSession _session;
1412

15-
public EfCoreQueryWatchInterceptor(QueryWatchSession session)
16-
{
13+
public EfCoreQueryWatchInterceptor(QueryWatchSession session) {
1714
_session = session ?? throw new ArgumentNullException(nameof(session));
1815
}
1916

20-
private static void Record(QueryWatchSession session, DbCommand command, long elapsedTicks)
21-
{
17+
private static void Record(QueryWatchSession session, DbCommand command, long elapsedTicks) {
2218
var duration = TimeSpan.FromTicks(elapsedTicks);
2319
var text = command.CommandText ?? string.Empty;
2420
session.Record(text, duration);
@@ -27,8 +23,7 @@ private static void Record(QueryWatchSession session, DbCommand command, long el
2723
public override DbDataReader ReaderExecuted(
2824
DbCommand command,
2925
CommandExecutedEventData eventData,
30-
DbDataReader result)
31-
{
26+
DbDataReader result) {
3227
Record(_session, command, eventData.Duration.Ticks);
3328
return base.ReaderExecuted(command, eventData, result);
3429
}
@@ -37,20 +32,17 @@ public override ValueTask<DbDataReader> ReaderExecutedAsync(
3732
DbCommand command,
3833
CommandExecutedEventData eventData,
3934
DbDataReader result,
40-
CancellationToken cancellationToken = default)
41-
{
35+
CancellationToken cancellationToken = default) {
4236
Record(_session, command, eventData.Duration.Ticks);
4337
return base.ReaderExecutedAsync(command, eventData, result, cancellationToken);
4438
}
4539

46-
public override int NonQueryExecuted(DbCommand command, CommandExecutedEventData eventData, int result)
47-
{
40+
public override int NonQueryExecuted(DbCommand command, CommandExecutedEventData eventData, int result) {
4841
Record(_session, command, eventData.Duration.Ticks);
4942
return base.NonQueryExecuted(command, eventData, result);
5043
}
5144

52-
public override object? ScalarExecuted(DbCommand command, CommandExecutedEventData eventData, object? result)
53-
{
45+
public override object? ScalarExecuted(DbCommand command, CommandExecutedEventData eventData, object? result) {
5446
Record(_session, command, eventData.Duration.Ticks);
5547
return base.ScalarExecuted(command, eventData, result);
5648
}

src/KeelMatrix.QueryWatch/IO/PathUtils.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
namespace KeelMatrix.QueryWatch.IO
2-
{
1+
namespace KeelMatrix.QueryWatch.IO {
32
/// <summary>
43
/// Provides helpers for working with file system paths in a cross‑platform way.
54
/// Use these helpers instead of building paths manually to avoid problems
65
/// related to directory separators on Windows versus Linux/macOS.
76
/// </summary>
8-
public static class PathUtils
9-
{
7+
public static class PathUtils {
108
/// <summary>
119
/// Combines path segments using the platform's directory separator.
1210
/// </summary>

src/KeelMatrix.QueryWatch/IQueryTextRedactor.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#nullable enable
2-
namespace KeelMatrix.QueryWatch
3-
{
2+
namespace KeelMatrix.QueryWatch {
43
/// <summary>
54
/// Redacts sensitive or noisy content from SQL text before it is recorded.
65
/// Redactors are applied by <see cref="QueryWatchSession.Record(string, System.TimeSpan)"/> in the order they appear in <see cref="QueryWatchOptions.Redactors"/>.
76
/// </summary>
8-
public interface IQueryTextRedactor
9-
{
7+
public interface IQueryTextRedactor {
108
/// <summary>
119
/// Return a redacted version of the input string.
1210
/// </summary>
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
namespace KeelMatrix.QueryWatch.Licensing
2-
{
1+
namespace KeelMatrix.QueryWatch.Licensing {
32
/// <summary>
43
/// Represents a mechanism to validate license keys for premium features.
54
/// Implement this interface to integrate with your merchant‑of‑record (Paddle, Lemon Squeezy, etc.).
65
/// </summary>
7-
public interface ILicenseValidator
8-
{
6+
public interface ILicenseValidator {
97
/// <summary>
108
/// Determines whether the given license key is valid.
119
/// </summary>
@@ -19,9 +17,8 @@ public interface ILicenseValidator
1917
/// Always returns <c>true</c>. Replace with your own implementation to enforce license checks.
2018
/// TODO: Hook this into your API surface where paid features should enforce license checks.
2119
/// </summary>
22-
public sealed class NoopLicenseValidator : ILicenseValidator
23-
{
20+
public sealed class NoopLicenseValidator : ILicenseValidator {
2421
/// <inheritdoc />
2522
public bool IsValid(string licenseKey) => true;
2623
}
27-
}
24+
}

src/KeelMatrix.QueryWatch/QueryEvent.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
// Copyright (c) KeelMatrix
22
#nullable enable
3-
namespace KeelMatrix.QueryWatch
4-
{
3+
namespace KeelMatrix.QueryWatch {
54
/// <summary>
65
/// A single observed database command execution.
76
/// High level skeleton only — the structure may evolve before 1.0.
87
/// </summary>
9-
public sealed class QueryEvent
10-
{
11-
public QueryEvent(string commandText, TimeSpan duration, DateTimeOffset at)
12-
{
8+
public sealed class QueryEvent {
9+
public QueryEvent(string commandText, TimeSpan duration, DateTimeOffset at) {
1310
CommandText = commandText;
1411
Duration = duration;
1512
At = at;

src/KeelMatrix.QueryWatch/QueryWatchOptions.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#nullable enable
2-
namespace KeelMatrix.QueryWatch
3-
{
2+
namespace KeelMatrix.QueryWatch {
43
/// <summary>
54
/// Options for a monitoring session.
65
/// Keep intentionally small; extensible via future minor versions.
76
/// </summary>
8-
public sealed class QueryWatchOptions
9-
{
7+
public sealed class QueryWatchOptions {
108
/// <summary>
119
/// Maximum number of queries allowed before <see cref="QueryWatchReport.ThrowIfViolations"/> fails.
1210
/// Null means "no limit". Default: null.

0 commit comments

Comments
 (0)