Skip to content

Commit

Permalink
chore(build): remove warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashilzendegen committed May 14, 2024
1 parent 0e53a54 commit 19bac4e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static class TypeExtensions
/// </summary>
/// <param name="type">The <see cref="Type"/>.</param>
/// <returns>The simple name of the assembly.</returns>
public static string GetAssemblySimpleName(this Type type)
public static string? GetAssemblySimpleName(this Type type)
=> type.Assembly.GetName().Name;

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Thinktecture.Relay.Abstractions/TimeSpanJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Thinktecture.Relay;
internal class TimeSpanJsonConverter : JsonConverter<TimeSpan>
{
public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
=> TimeSpan.Parse(reader.GetString(), CultureInfo.InvariantCulture);
=> TimeSpan.Parse(reader.GetString() ?? TimeSpan.Zero.ToString(), CultureInfo.InvariantCulture);

public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options)
=> writer.WriteStringValue(value.ToString("c"));
Expand All @@ -18,7 +18,7 @@ internal class NullableTimeSpanJsonConverter : JsonConverter<TimeSpan?>
{
public override TimeSpan? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
=> reader.TokenType == JsonTokenType.String
? TimeSpan.Parse(reader.GetString(), CultureInfo.InvariantCulture)
? TimeSpan.Parse(reader.GetString() ?? TimeSpan.Zero.ToString(), CultureInfo.InvariantCulture)
: null;

public override void Write(Utf8JsonWriter writer, TimeSpan? value, JsonSerializerOptions options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ namespace Thinktecture.Relay.Connector.Targets;
/// An implementation of a target.
/// </summary>
/// <remarks>This is just a marker interface.</remarks>
public interface IRelayTarget
{
}
public interface IRelayTarget;

/// <summary>
/// An implementation of a target executing logic triggered by a request.
Expand All @@ -32,9 +30,7 @@ public interface IRelayTargetAction<in TRequest> : IRelayTarget
}

/// <inheritdoc />
public interface IRelayTargetAction : IRelayTargetAction<ClientRequest>
{
}
public interface IRelayTargetAction : IRelayTargetAction<ClientRequest>;

/// <summary>
/// An implementation of a target providing the necessary response information for a request.
Expand All @@ -58,6 +54,4 @@ public interface IRelayTargetFunc<in TRequest, TResponse> : IRelayTarget
}

/// <inheritdoc />
public interface IRelayTargetFunc : IRelayTargetFunc<ClientRequest, TargetResponse>
{
}
public interface IRelayTargetFunc : IRelayTargetFunc<ClientRequest, TargetResponse>;
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,4 @@ Task OnRequestReceivedAsync(IRelayContext<TRequest, TResponse> context,
/// <summary>
/// An implementation of an interceptor dealing with the request of the client.
/// </summary>
public interface IClientRequestInterceptor : IClientRequestInterceptor<ClientRequest, TargetResponse>
{
}
public interface IClientRequestInterceptor : IClientRequestInterceptor<ClientRequest, TargetResponse>;
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,4 @@ Task OnResponseReceivedAsync(IRelayContext<TRequest, TResponse> context,
/// <summary>
/// An implementation of an interceptor dealing with the response of a target.
/// </summary>
public interface ITargetResponseInterceptor : ITargetResponseInterceptor<ClientRequest, TargetResponse>
{
}
public interface ITargetResponseInterceptor : ITargetResponseInterceptor<ClientRequest, TargetResponse>;
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ private Uri BuildBaseUri(HttpRequest request)
protected virtual string? GetAuthority()
{
var authority = _serviceProvider.GetService<IOptionsSnapshot<JwtBearerOptions>>()
?.Get(Constants.DefaultAuthenticationScheme)
?.Authority;
?.Get(Constants.DefaultAuthenticationScheme).Authority;
if (authority is null) return null;

return authority.EndsWith("/") ? authority : $"{authority}/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ public static IServiceCollection AddRelayServerDbContext(this IServiceCollection
{
if ("SqlServer".Equals(configuration.GetValue<string>("DatabaseType"),
StringComparison.InvariantCultureIgnoreCase))
return Server.Persistence.EntityFrameworkCore.SqlServer.ServiceCollectionExtensions
return Persistence.EntityFrameworkCore.SqlServer.ServiceCollectionExtensions
.AddRelayServerDbContext(services, configuration.GetConnectionString("SqlServer")
?? throw new InvalidOperationException("No 'SqlServer' connection string found."));

return Server.Persistence.EntityFrameworkCore.PostgreSql.ServiceCollectionExtensions
return Persistence.EntityFrameworkCore.PostgreSql.ServiceCollectionExtensions
.AddRelayServerDbContext(services, configuration.GetConnectionString("PostgreSql")
?? throw new InvalidOperationException("No 'PostgreSql' connection string found."));
}
Expand Down

0 comments on commit 19bac4e

Please sign in to comment.