Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,14 @@ class Build : NukeBuild
}
});

private Dictionary<string, string[]> ReferencedProjects = new()
private readonly Dictionary<string, string[]> ReferencedProjects = new()
{
{ "jasperfx", ["JasperFx", "JasperFx.Events", "EventTests", "JasperFx.RuntimeCompiler"] },
{ "weasel", ["Weasel.Core", "Weasel.Postgresql"] },
{"lamar", ["Lamar", "Lamar.Microsoft.DependencyInjection"]}
};

string[] Nugets = ["JasperFx", "JasperFx.Events", "JasperFx.RuntimeCompiler", "Weasel.Postgresql"];
readonly string[] Nugets = ["JasperFx", "JasperFx.Events", "JasperFx.RuntimeCompiler", "Weasel.Postgresql"];

Target Attach => _ => _.Executes(() =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public class EventTracingConnectionLifetimeCollection
[Collection(nameof(EventTracingConnectionLifetimeCollection))]
public class EventTracingConnectionLifetimeTests : IAsyncLifetime
{
private NpgsqlCommand _npgsqlCommand = new("select 1");
private readonly NpgsqlCommand _npgsqlCommand = new("select 1");
private IConnectionLifetime? _innerConnectionLifetime = Substitute.For<IConnectionLifetime>();
private bool _startCalled;
private bool _endCalled;
private List<OperationPage> _batchPages =new();
private List<Exception> _exceptions =new();
private BatchBuilder _batchBuilder =new();
private readonly List<OperationPage> _batchPages =new();
private readonly List<Exception> _exceptions =new();
private readonly BatchBuilder _batchBuilder =new();
private NpgsqlBatch _batch;
private DataTable _dataTable =new();
private readonly DataTable _dataTable =new();
private DbDataReader _dataReader;

private const string MartenCommandExecutionStarted = "marten.command.execution.started";
Expand Down
2 changes: 1 addition & 1 deletion src/DaemonTests/TestingSupport/DaemonContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace DaemonTests.TestingSupport;

public abstract class DaemonContext: OneOffConfigurationsContext, IAsyncLifetime
{
private int lockId = 10000;
private readonly int lockId = 10000;

protected DaemonContext(ITestOutputHelper output)
{
Expand Down
2 changes: 1 addition & 1 deletion src/DocumentDbTests/Bugs/Bug_2942_include_error.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Bug_2942_include_error : BugIntegrationContext
public record DocumentA(Guid Id, string DetailA);
public record DocumentB(Guid Id, string DetailB);

private Guid THEID = Guid.NewGuid();
private readonly Guid THEID = Guid.NewGuid();

[Fact]
public async Task query_with_include()
Expand Down
2 changes: 1 addition & 1 deletion src/DocumentDbTests/Bugs/Bug_3708_NGram_in_other_schema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace DocumentDbTests.Bugs;

public class Bug_3708_NGram_in_other_schema : BugIntegrationContext
{
private string AnotherSchema = "not_public";
private readonly string AnotherSchema = "not_public";

[Fact]
public async Task default_bug_context_schema()
Expand Down
2 changes: 1 addition & 1 deletion src/EventAppenderPerfTester/TripStreamReaderWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace EventAppenderPerfTester;

public static class TripStreamReaderWriter
{
private static JsonSerializer _serializer = JsonSerializer.Create(new JsonSerializerSettings
private static readonly JsonSerializer _serializer = JsonSerializer.Create(new JsonSerializerSettings
{
Formatting = Formatting.Indented,
TypeNameHandling = TypeNameHandling.Auto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace EventSourcingTests;
public class marking_events_as_skipped_as_string_identified : OneOffConfigurationsContext, IAsyncLifetime
{
private readonly ITestOutputHelper _output;
private string theStreamId = Guid.NewGuid().ToString();
private readonly string theStreamId = Guid.NewGuid().ToString();

public marking_events_as_skipped_as_string_identified(ITestOutputHelper output)
{
Expand Down
4 changes: 2 additions & 2 deletions src/LinqTests/Internals/SimpleExpressionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class SimpleExpressionTests
{
private static readonly DocumentQueryableMemberCollection Members = new(DocumentMapping.For<Target>(), new StoreOptions());

private static int Age = 49;
private string Color = "blue";
private const int Age = 49;
private const string Color = "blue";

private SimpleExpression parse(Expression<Func<bool>> expression)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Marten.Testing/Examples/RebuildRunner.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -28,7 +28,7 @@ public Shop Create(ShopCreated @event)
public class RebuildRunner
{
#region sample_rebuild-single-projection
private IDocumentStore _store;
private readonly IDocumentStore _store;

public RebuildRunner(IDocumentStore store)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Marten/Linq/Parsing/LinqQueryParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal partial class LinqQueryParser: ExpressionVisitor, ILinqQuery
private readonly MartenLinqQueryProvider _provider;


private bool _hasParsedIncludes;
private readonly bool _hasParsedIncludes;

public LinqQueryParser(MartenLinqQueryProvider provider, IMartenSession session,
Expression expression, SingleValueMode? valueMode = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal class ExcludeSoftDeletedFilter: ISoftDeletedFilter
{
public static readonly ExcludeSoftDeletedFilter Instance = new();

private static string _sql = $"d.{SchemaConstants.DeletedColumn} = False";
private const string _sql = $"d.{SchemaConstants.DeletedColumn} = False";

public void Apply(ICommandBuilder builder)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Marten/QueryableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -754,10 +754,10 @@ internal static LambdaExpression CompileOrderBy<T>(string property, out Type tar

#endregion

private static MethodInfo _orderBySqlMethod = typeof(QueryableExtensions).GetMethod(nameof(OrderBySql),
private static readonly MethodInfo _orderBySqlMethod = typeof(QueryableExtensions).GetMethod(nameof(OrderBySql),
BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic)!;

private static MethodInfo _thenBySqlMethod = typeof(QueryableExtensions).GetMethod(nameof(ThenBySql),
private static readonly MethodInfo _thenBySqlMethod = typeof(QueryableExtensions).GetMethod(nameof(ThenBySql),
BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic)!;

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Marten/Storage/MartenDatabase.EventStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Marten.Storage;

public partial class MartenDatabase : IEventDatabase
{
private string _storageIdentifier;
private readonly string _storageIdentifier;

public async Task MarkEventsAsSkipped(long[] sequences, CancellationToken token = default)
{
Expand Down
2 changes: 1 addition & 1 deletion src/MultiTenancyTests/SingleServerMultiTenancyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace MultiTenancyTests;
[CollectionDefinition("multi-tenancy", DisableParallelization = true)]
public class SingleServerMultiTenancyTests: IAsyncLifetime
{
private DefaultNpgsqlDataSourceFactory dataSourceFactory = new();
private readonly DefaultNpgsqlDataSourceFactory dataSourceFactory = new();
private SingleServerMultiTenancy theTenancy;

public async Task InitializeAsync()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void Dispose()
theSession?.Dispose();
}

private IDocumentSession theSession;
private readonly IDocumentSession theSession;

public async ValueTask DisposeAsync()
{
Expand Down Expand Up @@ -326,7 +326,7 @@ public void Dispose()
theSession?.Dispose();
}

private IDocumentSession theSession;
private readonly IDocumentSession theSession;

public async ValueTask DisposeAsync()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task DisposeAsync()
theSession?.Dispose();
}

private IDocumentSession theSession;
private readonly IDocumentSession theSession;

[Fact]
public void store_document_will_assign_the_identity()
Expand Down Expand Up @@ -304,7 +304,7 @@ public async Task DisposeAsync()
theSession?.Dispose();
}

private IDocumentSession theSession;
private readonly IDocumentSession theSession;

[Fact]
public void store_document_will_assign_the_identity()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task DisposeAsync()
theSession?.Dispose();
}

private IDocumentSession theSession;
private readonly IDocumentSession theSession;

[Fact]
public void store_document_will_assign_the_identity()
Expand Down Expand Up @@ -307,7 +307,7 @@ public async Task DisposeAsync()
theSession?.Dispose();
}

private IDocumentSession theSession;
private readonly IDocumentSession theSession;

[Fact]
public void store_document_will_assign_the_identity()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void Dispose()
theSession?.Dispose();
}

private IDocumentSession theSession;
private readonly IDocumentSession theSession;

public async ValueTask DisposeAsync()
{
Expand Down Expand Up @@ -285,7 +285,7 @@ public void Dispose()
theSession?.Dispose();
}

private IDocumentSession theSession;
private readonly IDocumentSession theSession;

public async ValueTask DisposeAsync()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void Dispose()
theSession?.Dispose();
}

private IDocumentSession theSession;
private readonly IDocumentSession theSession;

public async ValueTask DisposeAsync()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public async Task DisposeAsync()
theSession?.Dispose();
}

private IDocumentSession theSession;
private readonly IDocumentSession theSession;

[Fact]
public void store_document_will_assign_the_identity()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public async Task DisposeAsync()
theSession?.Dispose();
}

private IDocumentSession theSession;
private readonly IDocumentSession theSession;

[Fact]
public void store_document_will_assign_the_identity()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void Dispose()
theSession?.Dispose();
}

private IDocumentSession theSession;
private readonly IDocumentSession theSession;

public async ValueTask DisposeAsync()
{
Expand Down
2 changes: 1 addition & 1 deletion src/ValueTypeTests/include_usage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class include_usage : IAsyncDisposable
{
private readonly ITestOutputHelper _output;
private readonly DocumentStore theStore;
private IDocumentSession theSession;
private readonly IDocumentSession theSession;

public include_usage(ITestOutputHelper output)
{
Expand Down
Loading