Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to .NET Standard 2.1 #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion src/Qualm.AspNetCore.Swagger/AllOfDocumentFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Qualm.AspNetCore.Swagger
{
public class AllOfDocumentFilter<T> : IDocumentFilter
{
private readonly Type _type;
readonly Type _type;

public AllOfDocumentFilter()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Qualm.AspNetCore.Swagger/AllOfSchemaFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace Qualm.AspNetCore.Swagger
/// <typeparam name="T"></typeparam>
public class AllOfSchemaFilter<T> : ISchemaFilter
{
private readonly Type _type;
private readonly Lazy<IDictionary<Type, Type>> _types;
readonly Type _type;
readonly Lazy<IDictionary<Type, Type>> _types;

public AllOfSchemaFilter()
{
Expand Down
10 changes: 5 additions & 5 deletions src/Qualm.AspNetCore.Swagger/Qualm.AspNetCore.Swagger.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>1.0.5</Version>
<Title>Qualm.AspNetCore.Swagger</Title>
<Authors>Matt Kruskamp, Cory Hedges, Andrew Later, Chris Tanaka</Authors>
Expand All @@ -16,15 +16,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.2" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.2.2" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.2.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.4.0" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\LICENSE.txt">
<Pack>True</Pack>
<PackagePath></PackagePath>
<PackagePath/>
</None>
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Qualm.AspNetCore/Qualm.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>1.0.5</Version>
<Title>Qualm.AspNetCore</Title>
<Authors>Matt Kruskamp, Cory Hedges, Andrew Later, Chris Tanaka</Authors>
Expand Down
4 changes: 2 additions & 2 deletions src/Qualm.Rmq.Tests/DispatcherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace Qualm.Rmq.Tests
{
public class DispatcherTests
{
private readonly ILogger _logger;
private readonly ITestOutputHelper _output;
readonly ILogger _logger;
readonly ITestOutputHelper _output;

public DispatcherTests(ITestOutputHelper output)
{
Expand Down
14 changes: 7 additions & 7 deletions src/Qualm.Rmq.Tests/Qualm.Rmq.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Divergic.Logging.Xunit" Version="3.5.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="Moq" Version="4.9.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="Divergic.Logging.Xunit" Version="4.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Moq" Version="4.18.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/Qualm.Rmq/Qualm.Rmq.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>1.0.5</Version>
<Title>Qualm.Rmq</Title>
<Authors>Matt Kruskamp, Cory Hedges, Andrew Later, Chris Tanaka</Authors>
Expand All @@ -16,7 +16,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="RabbitMQ.Client" Version="5.1.0" />
<PackageReference Include="RabbitMQ.Client" Version="6.4.0" />
</ItemGroup>

<ItemGroup>
Expand All @@ -30,7 +30,7 @@
<ItemGroup>
<None Include="..\..\LICENSE.txt">
<Pack>True</Pack>
<PackagePath></PackagePath>
<PackagePath/>
</None>
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions src/Qualm.Rmq/RmqChannelFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace Qualm.Rmq
{
public class RmqChannelFactory
{
private readonly RmqConnectionFactory _mananger;
private readonly IList<string> _initializedQueues;
private readonly RmqConnectionDetails _connectionDetails;
readonly RmqConnectionFactory _mananger;
readonly IList<string> _initializedQueues;
readonly RmqConnectionDetails _connectionDetails;
private IModel _channel;

public RmqChannelFactory(
Expand Down
2 changes: 1 addition & 1 deletion src/Qualm.Rmq/RmqConnectionFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Qualm.Rmq
{
public class RmqConnectionFactory
{
private readonly RmqConnectionDetails _settings;
readonly RmqConnectionDetails _settings;
private IConnection connection;

public RmqConnectionFactory(RmqConnectionDetails settings)
Expand Down
18 changes: 9 additions & 9 deletions src/Qualm.Rmq/RmqDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ namespace Qualm.Rmq
{
public class RmqDispatcher
{
private readonly ILogger<RmqDispatcher> _logger;
private readonly IServiceProvider _serviceProvider;
private readonly Dictionary<string, Type> _commands;
private readonly RmqChannelFactory _channelFactory;
private readonly RmqConnectionDetails _connectionDetails;
private readonly IQueueMessageMapperRegistry _registry;
private readonly IQueueMessageMapperFactory _factory;
private readonly Dictionary<string, IModel> _commandChannels;
readonly ILogger<RmqDispatcher> _logger;
readonly IServiceProvider _serviceProvider;
readonly Dictionary<string, Type> _commands;
readonly RmqChannelFactory _channelFactory;
readonly RmqConnectionDetails _connectionDetails;
readonly IQueueMessageMapperRegistry _registry;
readonly IQueueMessageMapperFactory _factory;
readonly Dictionary<string, IModel> _commandChannels;

public RmqDispatcher(
IServiceProvider serviceProvider,
Expand Down Expand Up @@ -74,7 +74,7 @@ protected virtual void OnConsumerRecieved(object sender, BasicDeliverEventArgs e
var message = new QueueMessage
{
Subject = e.RoutingKey,
Body = Encoding.UTF8.GetString(e.Body)
Body = Encoding.UTF8.GetString(e.Body.Span)
};

var type = _commands[message.Subject];
Expand Down
4 changes: 2 additions & 2 deletions src/Qualm.Rmq/RmqQueueClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace Qualm.Rmq
{
public class RmqQueueClient : IQueueClient
{
private readonly RmqChannelFactory _channels;
private readonly RmqConnectionDetails _details;
readonly RmqChannelFactory _channels;
readonly RmqConnectionDetails _details;

public RmqQueueClient(
RmqChannelFactory channels,
Expand Down
2 changes: 1 addition & 1 deletion src/Qualm.Rmq/RmqQueueClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Qualm.Rmq
{
public class RmqQueueClientFactory : IQueueClientFactory
{
private readonly IServiceProvider _provider;
readonly IServiceProvider _provider;

public RmqQueueClientFactory(
IServiceProvider provider)
Expand Down
10 changes: 5 additions & 5 deletions src/Qualm.Tests/Qualm.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="Moq" Version="4.9.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Moq" Version="4.18.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 4 additions & 8 deletions src/Qualm.Tests/Queuing/InMemoryQueueClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,18 @@ namespace Qualm.Tests.Queuing
{
public class InMemoryQueueClient : IQueueClient
{
private readonly Queue<QueueMessage> _queue;
readonly Queue<QueueMessage> _queue;

public InMemoryQueueClient()
{
public InMemoryQueueClient() =>
_queue = new Queue<QueueMessage>();
}

public async Task SendAsync(QueueMessage message,
CancellationToken cancellationToken = default(CancellationToken))
{
CancellationToken cancellationToken = default(CancellationToken)) =>
await Task.Run(() => _queue.Enqueue(message));
}

public Queue<QueueMessage> Queue
{
get { return _queue; }
get => _queue;
}
}
}
10 changes: 4 additions & 6 deletions src/Qualm.Tests/Queuing/TestRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ namespace Qualm.Tests.Queuing
{
public class TestRequest : IRequest
{
private readonly Guid _id;
readonly Guid _id;

public TestRequest()
{
public TestRequest() =>
_id = Guid.NewGuid();
}

public Guid Id
{
get { return _id; }
get => _id;
}
}
}
}
12 changes: 4 additions & 8 deletions src/Qualm/Commands/CommandHandlerRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ namespace Qualm.Commands
{
public class CommandHandlerRegistry : ICommandHandlerRegistry
{
private readonly Dictionary<Type, Type> _types;
readonly Dictionary<Type, Type> _types;

public CommandHandlerRegistry()
{
public CommandHandlerRegistry() =>
_types = new Dictionary<Type, Type>();
}

public virtual Type GetHandler(Type commandType)
{
return _types.ContainsKey(commandType) ? _types[commandType] : null;
}
public virtual Type? GetHandler(Type commandType) =>
_types!.ContainsKey(commandType) ? _types[commandType] : null;

public virtual void RegisterHandler(Type commandType, Type commandHandlerType)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Qualm/Commands/CommandProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace Qualm.Commands
{
public class CommandProcessor : ICommandProcessor
{
private readonly ICommandHandlerRegistry _registry;
private readonly ICommandHandlerFactory _factory;
readonly ICommandHandlerRegistry _registry;
readonly ICommandHandlerFactory _factory;

public CommandProcessor(
ICommandHandlerRegistry registry,
Expand All @@ -34,7 +34,7 @@ public async Task ExecuteAsync(ICommand command,
private ICommandHandler GetHandler(ICommand command)
{
var type = command.GetType();
var handlerType = _registry.GetHandler(type);
var handlerType = _registry.GetHandler(type)!;
var handler = _factory.Create(handlerType);

return handler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace Qualm.Commands.DependencyInjection
{
public class ServiceCollectionCommandHandlerRegistry : CommandHandlerRegistry
{
private readonly IServiceCollection _services;
private readonly ServiceLifetime _lifetime;
readonly IServiceCollection _services;
readonly ServiceLifetime _lifetime;

public ServiceCollectionCommandHandlerRegistry(
IServiceCollection services,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Qualm.Commands.DependencyInjection
public class ServiceProviderCommandHandlerFactory
: ICommandHandlerFactory
{
private readonly IServiceProvider _provider;
readonly IServiceProvider _provider;

public ServiceProviderCommandHandlerFactory(
IServiceProvider provider)
Expand All @@ -23,7 +23,7 @@ public ICommandHandler Create(Type handlerType)
$"{handlerType.Name} must be an ICommandHandler");

var service = _provider.GetService(handlerType);
return service as ICommandHandler;
return (service as ICommandHandler)!;
}
}
}
2 changes: 1 addition & 1 deletion src/Qualm/Commands/ICommandHandlerRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Qualm.Commands
{
public interface ICommandHandlerRegistry
{
Type GetHandler(Type commandType);
Type? GetHandler(Type commandType);

void RegisterHandler(Type commandType, Type commandHandlerType);

Expand Down
14 changes: 8 additions & 6 deletions src/Qualm/Qualm.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1</TargetFrameworks>
<Nullable>enable</Nullable>
<Features>strict</Features>
<Version>1.0.5</Version>
<Title>Qualm</Title>
<Authors>Matt Kruskamp, Cory Hedges, Andrew Later, Chris Tanaka</Authors>
Expand All @@ -16,10 +18,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net452'">
Expand All @@ -29,7 +31,7 @@
<ItemGroup>
<None Include="..\..\LICENSE.txt">
<Pack>True</Pack>
<PackagePath></PackagePath>
<PackagePath/>
</None>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace Qualm.Queries.DependencyInjection
{
public class ServiceCollectionQueryHandlerRegistry : QueryHandlerRegistry
{
private readonly IServiceCollection _services;
private readonly ServiceLifetime _lifetime;
readonly IServiceCollection _services;
readonly ServiceLifetime _lifetime;

public ServiceCollectionQueryHandlerRegistry(
IServiceCollection services,
Expand Down
Loading