Skip to content

Commit

Permalink
Updated to .NET 7 and bumped all dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardudycz committed Nov 16, 2022
1 parent fad9210 commit f439c7c
Show file tree
Hide file tree
Showing 123 changed files with 524 additions and 490 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.dotnet.yml
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
dotnet-version: "7.0.x"

- name: Restore NuGet packages
run: dotnet restore
Expand Down
10 changes: 5 additions & 5 deletions CQRS.Tests/CQRS.Tests.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -11,10 +11,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.7.0" />
<PackageReference Include="Marten" Version="5.10.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="MediatR" Version="10.0.1" />
<PackageReference Include="FluentAssertions" Version="6.8.0" />
<PackageReference Include="Marten" Version="6.0.0-alpha.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="MediatR" Version="11.0.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
Expand Down
4 changes: 3 additions & 1 deletion Core.ElasticSearch/Config.cs
@@ -1,3 +1,4 @@
using Core.Configuration;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Nest;
Expand All @@ -13,10 +14,11 @@ public class ElasticSearchConfig
public static class ElasticSearchConfigExtensions
{
private const string DefaultConfigKey = "ElasticSearch";

public static IServiceCollection AddElasticsearch(
this IServiceCollection services, IConfiguration configuration, Action<ConnectionSettings>? config = null)
{
var elasticSearchConfig = configuration.GetSection(DefaultConfigKey).Get<ElasticSearchConfig>();
var elasticSearchConfig = configuration.GetRequiredConfig<ElasticSearchConfig>(DefaultConfigKey);

var settings = new ConnectionSettings(new Uri(elasticSearchConfig.Url))
.DefaultIndex(elasticSearchConfig.DefaultIndex);
Expand Down
10 changes: 5 additions & 5 deletions Core.ElasticSearch/Core.ElasticSearch.csproj
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>


<ItemGroup>
<PackageReference Include="NEST" Version="7.17.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="NEST" Version="7.17.5" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions Core.EventStoreDB.Tests/Core.EventStoreDB.Tests.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -15,8 +15,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="FluentAssertions" Version="6.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
Expand Down
3 changes: 2 additions & 1 deletion Core.EventStoreDB/Config.cs
@@ -1,4 +1,5 @@
using Core.BackgroundWorkers;
using Core.Configuration;
using Core.EventStoreDB.OptimisticConcurrency;
using Core.EventStoreDB.Subscriptions;
using EventStore.Client;
Expand All @@ -23,7 +24,7 @@ public static class EventStoreDBConfigExtensions

public static IServiceCollection AddEventStoreDB(this IServiceCollection services, IConfiguration config, EventStoreDBOptions? options = null)
{
var eventStoreDBConfig = config.GetSection(DefaultConfigKey).Get<EventStoreDBConfig>();
var eventStoreDBConfig = config.GetRequiredConfig<EventStoreDBConfig>(DefaultConfigKey);

services
.AddSingleton(new EventStoreClient(EventStoreClientSettings.Create(eventStoreDBConfig.ConnectionString)))
Expand Down
10 changes: 5 additions & 5 deletions Core.EventStoreDB/Core.EventStoreDB.csproj
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>


<ItemGroup>
<PackageReference Include="EventStore.Client.Grpc.Streams" Version="22.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions Core.Kafka.Tests/Core.Kafka.Tests.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -15,8 +15,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="FluentAssertions" Version="6.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
Expand Down
2 changes: 1 addition & 1 deletion Core.Kafka.Tests/KafkaProducerTests.cs
Expand Up @@ -13,7 +13,7 @@ public class KafkaProducerTests
{
private readonly IConfiguration kafkaConfig = new ConfigurationBuilder()
.AddInMemoryCollection(
new Dictionary<string, string>
new Dictionary<string, string?>
{
{ "KafkaProducer:ProducerConfig:BootstrapServers", "localhost:9092" },
{ "KafkaProducer:Topic", "MeetingsManagement" },
Expand Down
5 changes: 3 additions & 2 deletions Core.Kafka/Consumers/KafkaConsumerConfig.cs
@@ -1,4 +1,5 @@
using Confluent.Kafka;
using Core.Configuration;
using Microsoft.Extensions.Configuration;

namespace Core.Kafka.Consumers;
Expand All @@ -13,10 +14,10 @@ public class KafkaConsumerConfig

public static class KafkaConsumerConfigExtensions
{
public const string DefaultConfigKey = "KafkaConsumer";
private const string DefaultConfigKey = "KafkaConsumer";

public static KafkaConsumerConfig GetKafkaConsumerConfig(this IConfiguration configuration)
{
return configuration.GetSection(DefaultConfigKey).Get<KafkaConsumerConfig>();
return configuration.GetRequiredConfig<KafkaConsumerConfig>(DefaultConfigKey);
}
}
6 changes: 3 additions & 3 deletions Core.Kafka/Core.Kafka.csproj
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Confluent.Kafka" Version="1.9.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

Expand Down
9 changes: 4 additions & 5 deletions Core.Kafka/Producers/KafkaProducerConfig.cs
@@ -1,4 +1,5 @@
using Confluent.Kafka;
using Core.Configuration;
using Microsoft.Extensions.Configuration;

namespace Core.Kafka.Producers;
Expand All @@ -11,10 +12,8 @@ public class KafkaProducerConfig

public static class KafkaProducerConfigExtensions
{
public const string DefaultConfigKey = "KafkaProducer";
private const string DefaultConfigKey = "KafkaProducer";

public static KafkaProducerConfig GetKafkaProducerConfig(this IConfiguration configuration)
{
return configuration.GetSection(DefaultConfigKey).Get<KafkaProducerConfig>();
}
public static KafkaProducerConfig GetKafkaProducerConfig(this IConfiguration configuration) =>
configuration.GetRequiredConfig<KafkaProducerConfig>(DefaultConfigKey);
}
3 changes: 2 additions & 1 deletion Core.Marten/Config.cs
@@ -1,3 +1,4 @@
using Core.Configuration;
using Core.Ids;
using Core.Marten.Events;
using Core.Marten.Ids;
Expand Down Expand Up @@ -39,7 +40,7 @@ public static class MartenConfigExtensions
string configKey = DefaultConfigKey
)
{
var martenConfig = config.GetSection(configKey).Get<Config>();
var martenConfig = config.GetRequiredConfig<Config>(configKey);

services
.AddScoped<IIdGenerator, MartenIdGenerator>()
Expand Down
12 changes: 6 additions & 6 deletions Core.Marten/Core.Marten.csproj
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Marten" Version="5.10.1" />
<PackageReference Include="MediatR" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Marten" Version="6.0.0-alpha.3" />
<PackageReference Include="MediatR" Version="11.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Core.Serialization/Core.Serialization.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
16 changes: 8 additions & 8 deletions Core.Testing/Core.Testing.csproj
@@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<IsTestProject>false</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bogus" Version="34.0.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="FluentAssertions" Version="6.7.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.9" />
<PackageReference Include="Ogooreck" Version="0.3.0" />
<PackageReference Include="FluentAssertions" Version="6.8.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" />
<PackageReference Include="Ogooreck" Version="0.5.1" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Core.Testing/TestWebHostBuilder.cs
Expand Up @@ -6,7 +6,7 @@ namespace Core.Testing;

public static class TestWebHostBuilder
{
public static IWebHostBuilder Create(Dictionary<string, string> configuration, Action<IServiceCollection>? configureServices = null)
public static IWebHostBuilder Create(IEnumerable<KeyValuePair<string, string?>> configuration, Action<IServiceCollection>? configureServices = null)
{
var projectDir = Directory.GetCurrentDirectory();
configureServices ??= _ => { };
Expand All @@ -22,4 +22,4 @@ public static IWebHostBuilder Create(Dictionary<string, string> configuration, A
)
.ConfigureServices(configureServices);
}
}
}
8 changes: 4 additions & 4 deletions Core.Tests/Core.Tests.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -15,9 +15,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.7.0" />
<PackageReference Include="Marten" Version="5.10.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="FluentAssertions" Version="6.8.0" />
<PackageReference Include="Marten" Version="6.0.0-alpha.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
Expand Down
4 changes: 2 additions & 2 deletions Core.WebApi/Core.WebApi.csproj
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>

Expand Down
3 changes: 3 additions & 0 deletions Core.WebApi/Headers/ETagExtensions.cs
Expand Up @@ -22,6 +22,9 @@ public static void TrySetETagResponseHeader(this HttpResponse response, object e
public static string GetSanitizedValue(this EntityTagHeaderValue eTag)
{
var value = eTag.Tag.Value;

if (value is null)
throw new ArgumentNullException(nameof(eTag));
// trim first and last quote characters
return value.Substring(1, value.Length - 2);
}
Expand Down
4 changes: 2 additions & 2 deletions Core.WebApi/Tracing/TracingHeadersExtensions.cs
Expand Up @@ -11,13 +11,13 @@ public static class TracingHeadersExtensions

public static CorrelationId? GetCorrelationId(this HttpRequest request) =>
request.Headers.TryGetValue(CorrelationIdHeaderName, out var correlationId)
? new CorrelationId(correlationId)
? new CorrelationId(correlationId!)
: null;


public static CausationId? GetCausationId(this HttpRequest request) =>
request.Headers.TryGetValue(CausationIdHeaderName, out var correlationId)
? new CausationId(correlationId)
? new CausationId(correlationId!)
: null;

public static void SetCorrelationId(this HttpResponse response, CorrelationId correlationId) =>
Expand Down
16 changes: 16 additions & 0 deletions Core/Configuration/ConfigurationExtensions.cs
@@ -0,0 +1,16 @@
using Microsoft.Extensions.Configuration;

namespace Core.Configuration;

public static class ConfigurationExtensions
{
public static T GetRequiredConfig<T>(this IConfiguration configuration, string configurationKey) =>
configuration.GetRequiredSection(configurationKey).Get<T>()
?? throw new InvalidOperationException(
$"{typeof(T).Name} configuration wasn't found for '${configurationKey}' key");

public static string GetRequiredConnectionString(this IConfiguration configuration, string configurationKey) =>
configuration.GetConnectionString("Incidents")
?? throw new InvalidOperationException(
$"Configuration string with name '${configurationKey}' was not found");
}

0 comments on commit f439c7c

Please sign in to comment.