diff --git a/.gitignore b/.gitignore
index 9e7e7fb..78ee638 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@ obj/
bin/
build/
deploy/
+nuget/
TestResults/
*.bak
*.user
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index efa72b3..c5ed99d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -15,7 +15,7 @@
* when creating a new package, make sure to:
* maintain the repo structure (see existing packages)
* add code analyzers
- * create the package's README.md
+ * create the package's README.md
* initialize the package's CHANGELOG.md
* add tests
* consider presenting usage in Demo app (`/samples`)
@@ -23,5 +23,5 @@
## Coding style
-The coding style is guarded by the analyzers (such as stylecop) and .editorconfig.
-Make sure to follow the defined standards.
\ No newline at end of file
+The coding style is guarded by the analyzers (such as stylecop) and .editorconfig.
+Make sure to follow the defined standards.
diff --git a/README.md b/README.md
index ae66161..1ed0d5f 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Allegro.Extensions
+# Allegro.Extensions
This repo contains utility packages that can be shared between Allegro services, but are not required. Everyone can be an author of such package - the goal of this repository is to make it easier and quicker to share useful code snippets, helpers, extensions etc, with as little effort as possible.
@@ -8,7 +8,7 @@ This repo contains utility packages that can be shared between Allegro services,
Every PR is welcomed. You can extend existing packages and add new ones.
-Please refer to [Contributing guideline](CONTRIBUTING.md) for details.
+Please refer to [Contributing guideline](CONTRIBUTING.md) for details.
***
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests/.editorconfig b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests/.editorconfig
deleted file mode 100644
index c6cfa88..0000000
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests/.editorconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-[*.{cs,fs}]
-dotnet_diagnostic.CS1591.severity = none
\ No newline at end of file
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests/Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests.csproj b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests/Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests.csproj
index 6fdbd5b..4ecf9e3 100644
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests/Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests.csproj
+++ b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests/Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests.csproj
@@ -1,36 +1,22 @@
-
-
- enable
- false
-
-
-
-
-
-
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
- all
- runtime; build; native; contentfiles; analyzers
-
-
- all
- runtime; compile; build; native; contentfiles; analyzers
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests/SamplingFilterTests.cs b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests/SamplingFilterTests.cs
index d7ae293..c62f157 100644
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests/SamplingFilterTests.cs
+++ b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests/SamplingFilterTests.cs
@@ -98,14 +98,14 @@ public class SamplingFilterTests : FilterTests new(d);
- ApplyDependencyRules(dependency, filter, DependencyMap);
+ ApplyDependencyRules(dependency, filter!, DependencyMap);
((ISupportSampling)dependency).SamplingPercentage.Should().Be(shouldSample ? null : 100);
}
@@ -208,13 +208,13 @@ public void Dependencies_Rules(
[InlineData(null, null, null, 150, true, null, "CloudRoleName eq 'SomeService'", true)]
[InlineData(null, null, null, 150, true, null, "startswith(CloudRoleName, 'SomeService')", true)]
public void Requests_Rules(
- string cloudRoleName,
- string name,
+ string? cloudRoleName,
+ string? name,
string? url,
int duration,
bool success,
- string responseCode,
- string filter,
+ string? responseCode,
+ string? filter,
bool shouldSample)
{
var requestTelemetry = new RequestTelemetry(
@@ -231,7 +231,7 @@ public void Requests_Rules(
RequestForFilter RequestMap(RequestTelemetry d) => new(d);
- ApplyRequestRules(requestTelemetry, filter, RequestMap);
+ ApplyRequestRules(requestTelemetry, filter!, RequestMap);
((ISupportSampling)requestTelemetry).SamplingPercentage.Should().Be(shouldSample ? null : 100);
}
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore/Allegro.Extensions.ApplicationInsights.AspNetCore.csproj b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore/Allegro.Extensions.ApplicationInsights.AspNetCore.csproj
index 8054351..f81d0f8 100644
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore/Allegro.Extensions.ApplicationInsights.AspNetCore.csproj
+++ b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore/Allegro.Extensions.ApplicationInsights.AspNetCore.csproj
@@ -1,28 +1,19 @@
-
-
- enable
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers
-
-
- all
- runtime; compile; build; native; contentfiles; analyzers
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore/InternalsVisibleTo.cs b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore/InternalsVisibleTo.cs
deleted file mode 100644
index 095ceb5..0000000
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore/InternalsVisibleTo.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-using System.Runtime.CompilerServices;
-
-[assembly: InternalsVisibleTo(
- "Allegro.Extensions.ApplicationInsights.AspNetCore.UnitTests")]
-[assembly: InternalsVisibleTo(
- "Allegro.Extensions.ApplicationInsights.Demo.UnitTests")]
\ No newline at end of file
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore/StartupExtensions.cs b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore/StartupExtensions.cs
index 5e029d9..6e73b58 100644
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore/StartupExtensions.cs
+++ b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.AspNetCore/StartupExtensions.cs
@@ -86,9 +86,11 @@ public static ApplicationInsightsExtensionsBuilder AddApplicationInsightsTelemet
private static string GetConnectionString(string? connectionString, IConfiguration configuration, IHostEnvironment env)
{
- var sendConfig = configuration.GetSection(MainSection).Get();
+ var sendConfig = configuration.GetSection(MainSection).Get()
+ ?? throw new InvalidOperationException("Missing SendConfig configuration section in ApplicationInsights configuration!");
return env.IsDevelopment() && sendConfig.DisableLocally ? "InstrumentationKey=FakeKey" :
- connectionString ?? configuration.GetSection(MainSection)["ConnectionString"];
+ connectionString ?? (configuration.GetSection(MainSection)["ConnectionString"]
+ ?? throw new InvalidOperationException("Missing ConnectionString configuration in ApplicationInsights configuration!"));
}
///
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo.UnitTests/.editorconfig b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo.UnitTests/.editorconfig
deleted file mode 100644
index c6cfa88..0000000
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo.UnitTests/.editorconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-[*.{cs,fs}]
-dotnet_diagnostic.CS1591.severity = none
\ No newline at end of file
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo.UnitTests/Allegro.Extensions.ApplicationInsights.Demo.UnitTests.csproj b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo.UnitTests/Allegro.Extensions.ApplicationInsights.Demo.UnitTests.csproj
index c1760c8..327f206 100644
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo.UnitTests/Allegro.Extensions.ApplicationInsights.Demo.UnitTests.csproj
+++ b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo.UnitTests/Allegro.Extensions.ApplicationInsights.Demo.UnitTests.csproj
@@ -1,37 +1,23 @@
-
-
- enable
- false
-
-
-
-
-
-
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
- all
- runtime; build; native; contentfiles; analyzers
-
-
- all
- runtime; compile; build; native; contentfiles; analyzers
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo.UnitTests/ExcludeFromSamplingTelemetryInitializerRulesTests.cs b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo.UnitTests/ExcludeFromSamplingTelemetryInitializerRulesTests.cs
index 8897501..5576e28 100644
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo.UnitTests/ExcludeFromSamplingTelemetryInitializerRulesTests.cs
+++ b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo.UnitTests/ExcludeFromSamplingTelemetryInitializerRulesTests.cs
@@ -7,7 +7,7 @@
namespace Allegro.Extensions.ApplicationInsights.Demo.UnitTests;
-internal class
+internal sealed class
CustomExcludeFromSamplingTelemetryInitializer : ExcludeFromSamplingTelemetryInitializer
{
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/.editorconfig b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/.editorconfig
new file mode 100644
index 0000000..6902e1a
--- /dev/null
+++ b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/.editorconfig
@@ -0,0 +1,3 @@
+[*.cs]
+# CS1591: Missing XML comment for publicly visible type or member
+dotnet_diagnostic.CS1591.severity = none
\ No newline at end of file
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/Allegro.Extensions.ApplicationInsights.Demo.csproj b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/Allegro.Extensions.ApplicationInsights.Demo.csproj
index 5e327ac..dbf8a43 100644
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/Allegro.Extensions.ApplicationInsights.Demo.csproj
+++ b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/Allegro.Extensions.ApplicationInsights.Demo.csproj
@@ -1,26 +1,15 @@
-
-
- enable
-
-
-
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers
-
-
- all
- runtime; compile; build; native; contentfiles; analyzers
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/Controllers/WeatherForecastController.cs b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/Controllers/WeatherForecastController.cs
index adff118..4daaac0 100644
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/Controllers/WeatherForecastController.cs
+++ b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/Controllers/WeatherForecastController.cs
@@ -3,8 +3,6 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
-#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
-
namespace Allegro.Extensions.ApplicationInsights.Demo.Controllers;
public record WeatherForecast(DateTime Date, int TemperatureC, string Summary);
@@ -13,10 +11,7 @@ public record WeatherForecast(DateTime Date, int TemperatureC, string Summary);
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
- private static readonly string[] Summaries = new[]
- {
- "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
- };
+ private static readonly string[] Summaries = ["Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"];
private readonly ILogger _logger;
private readonly IHttpClientFactory _httpClientFactory;
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/CustomDependencyForFilter.cs b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/CustomDependencyForFilter.cs
index be43519..f2d5bab 100644
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/CustomDependencyForFilter.cs
+++ b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/CustomDependencyForFilter.cs
@@ -1,6 +1,5 @@
using Allegro.Extensions.ApplicationInsights.AspNetCore;
using Microsoft.ApplicationInsights.DataContracts;
-#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
namespace Allegro.Extensions.ApplicationInsights.Demo;
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/InternalsVisibleTo.cs b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/InternalsVisibleTo.cs
deleted file mode 100644
index 5bf3168..0000000
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Demo/InternalsVisibleTo.cs
+++ /dev/null
@@ -1,4 +0,0 @@
-using System.Runtime.CompilerServices;
-
-[assembly: InternalsVisibleTo(
- "Allegro.Extensions.ApplicationInsights.Demo.UnitTests")]
\ No newline at end of file
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests/.editorconfig b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests/.editorconfig
index c6cfa88..a9405b8 100644
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests/.editorconfig
+++ b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests/.editorconfig
@@ -1,2 +1,3 @@
-[*.{cs,fs}]
-dotnet_diagnostic.CS1591.severity = none
\ No newline at end of file
+[*.cs]
+# CA1861: Avoid constant arrays as arguments
+dotnet_diagnostic.CA1861.severity = silent
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests.csproj b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests.csproj
index 2639292..6663e22 100644
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests.csproj
+++ b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests.csproj
@@ -1,35 +1,21 @@
-
-
- enable
- false
-
-
-
-
-
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
- all
- runtime; build; native; contentfiles; analyzers
-
-
- all
- runtime; compile; build; native; contentfiles; analyzers
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests/ApplicationInsightsToPrometheusMetricsInitializerTests.cs b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests/ApplicationInsightsToPrometheusMetricsInitializerTests.cs
index d4bc562..4c1f9ec 100644
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests/ApplicationInsightsToPrometheusMetricsInitializerTests.cs
+++ b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests/ApplicationInsightsToPrometheusMetricsInitializerTests.cs
@@ -22,7 +22,7 @@ public ApplicationInsightsToPrometheusMetricsInitializerTests()
[InlineData("Anything else", false, false)]
[InlineData("Process SomeTopic", false, false)]
[InlineData("Process SomeTopic", true, true)]
- public void ApplyRequestsIncludes(string name, bool includeBus, bool shouldInclude)
+ public void ApplyRequestsIncludes(string? name, bool includeBus, bool shouldInclude)
{
var count = 0;
var requestTelemetry = new RequestTelemetry(
@@ -51,7 +51,7 @@ public void ApplyRequestsIncludes(string name, bool includeBus, bool shouldInclu
[InlineData("http", new[] { "http" }, true)]
[InlineData("cosmos", new[] { "http", "cosmos" }, true)]
[InlineData("Some Type", new[] { "http", "cosmos" }, false)]
- public void ApplyDependencyIncludes(string type, string[] typesToInclude, bool shouldInclude)
+ public void ApplyDependencyIncludes(string? type, string[] typesToInclude, bool shouldInclude)
{
var count = 0;
var dependencyTelemetry = new DependencyTelemetry(
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus/Allegro.Extensions.ApplicationInsights.Prometheus.csproj b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus/Allegro.Extensions.ApplicationInsights.Prometheus.csproj
index fea3cf8..5217902 100644
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus/Allegro.Extensions.ApplicationInsights.Prometheus.csproj
+++ b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus/Allegro.Extensions.ApplicationInsights.Prometheus.csproj
@@ -1,25 +1,14 @@
-
-
- enable
- true
-
-
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers
-
-
- all
- runtime; compile; build; native; contentfiles; analyzers
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus/InternalsVisibleTo.cs b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus/InternalsVisibleTo.cs
deleted file mode 100644
index 62fb9f0..0000000
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus/InternalsVisibleTo.cs
+++ /dev/null
@@ -1,3 +0,0 @@
-using System.Runtime.CompilerServices;
-
-[assembly: InternalsVisibleTo("Allegro.Extensions.ApplicationInsights.Prometheus.UnitTests")]
\ No newline at end of file
diff --git a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus/PrometheusMetrics.cs b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus/PrometheusMetrics.cs
index d6f8223..5c1c6e6 100644
--- a/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus/PrometheusMetrics.cs
+++ b/src/Allegro.Extensions.ApplicationInsights/Allegro.Extensions.ApplicationInsights.Prometheus/PrometheusMetrics.cs
@@ -21,11 +21,8 @@ private static Histogram DependencyHistogramFactory(IMetricFactory metrics)
"The duration of dependency call",
new HistogramConfiguration
{
- LabelNames = new[]
- {
- "service", "type", "target", "name", "operation_name", "success", "resultCode"
- },
- Buckets = new[] { 0.008, 0.016, 0.032, 0.064, 0.128, 0.512, 1, 4, 16 }
+ LabelNames = ["service", "type", "target", "name", "operation_name", "success", "resultCode"],
+ Buckets = [0.008, 0.016, 0.032, 0.064, 0.128, 0.512, 1, 4, 16]
});
}
@@ -36,8 +33,8 @@ private static Histogram RequestHistogramFactory(IMetricFactory metrics)
"The duration of request",
new HistogramConfiguration
{
- LabelNames = new[] { "service", "name", "success", "resultCode" },
- Buckets = new[] { 0.008, 0.016, 0.032, 0.064, 0.128, 0.512, 1, 4, 16 }
+ LabelNames = ["service", "name", "success", "resultCode"],
+ Buckets = [0.008, 0.016, 0.032, 0.064, 0.128, 0.512, 1, 4, 16]
});
}
}
\ No newline at end of file
diff --git a/src/Allegro.Extensions.ApplicationInsights/Directory.Packages.props b/src/Allegro.Extensions.ApplicationInsights/Directory.Packages.props
new file mode 100644
index 0000000..9dd5a32
--- /dev/null
+++ b/src/Allegro.Extensions.ApplicationInsights/Directory.Packages.props
@@ -0,0 +1,28 @@
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore.Demo/.editorconfig b/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore.Demo/.editorconfig
new file mode 100644
index 0000000..6902e1a
--- /dev/null
+++ b/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore.Demo/.editorconfig
@@ -0,0 +1,3 @@
+[*.cs]
+# CS1591: Missing XML comment for publicly visible type or member
+dotnet_diagnostic.CS1591.severity = none
\ No newline at end of file
diff --git a/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore.Demo/Allegro.Extensions.AspNetCore.Demo.csproj b/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore.Demo/Allegro.Extensions.AspNetCore.Demo.csproj
index a48c3ee..a5d93b8 100644
--- a/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore.Demo/Allegro.Extensions.AspNetCore.Demo.csproj
+++ b/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore.Demo/Allegro.Extensions.AspNetCore.Demo.csproj
@@ -1,13 +1,9 @@
-
- false
- IDE0005
-
-
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore.Tests.Unit/Allegro.Extensions.AspNetCore.Tests.Unit.csproj b/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore.Tests.Unit/Allegro.Extensions.AspNetCore.Tests.Unit.csproj
index 1b42da6..8b7877d 100644
--- a/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore.Tests.Unit/Allegro.Extensions.AspNetCore.Tests.Unit.csproj
+++ b/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore.Tests.Unit/Allegro.Extensions.AspNetCore.Tests.Unit.csproj
@@ -1,19 +1,14 @@
-
- false
- false
- IDE0005
-
-
-
-
-
-
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore.csproj b/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore.csproj
index ead0131..0c9a71d 100644
--- a/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore.csproj
+++ b/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore.csproj
@@ -8,4 +8,7 @@
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore/InternalsVisibleTo.cs b/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore/InternalsVisibleTo.cs
deleted file mode 100644
index e3b7543..0000000
--- a/src/Allegro.Extensions.AspNetCore/Allegro.Extensions.AspNetCore/InternalsVisibleTo.cs
+++ /dev/null
@@ -1,3 +0,0 @@
-using System.Runtime.CompilerServices;
-
-[assembly: InternalsVisibleTo("Allegro.Extensions.AspNetCore.Tests.Unit")]
\ No newline at end of file
diff --git a/src/Allegro.Extensions.AspNetCore/Directory.Packages.props b/src/Allegro.Extensions.AspNetCore/Directory.Packages.props
new file mode 100644
index 0000000..f1cd49f
--- /dev/null
+++ b/src/Allegro.Extensions.AspNetCore/Directory.Packages.props
@@ -0,0 +1,14 @@
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.Abstractions/Allegro.Extensions.Cqrs.Abstractions.csproj b/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.Abstractions/Allegro.Extensions.Cqrs.Abstractions.csproj
index 49bf788..adb3922 100644
--- a/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.Abstractions/Allegro.Extensions.Cqrs.Abstractions.csproj
+++ b/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.Abstractions/Allegro.Extensions.Cqrs.Abstractions.csproj
@@ -2,11 +2,10 @@
Allegro.Extensions.Cqrs.Abstractions
Contains Cqrs basic abstractions used in Allegro services
- true
-
-
+
+
-
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.Demo/.editorconfig b/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.Demo/.editorconfig
new file mode 100644
index 0000000..ab73c2d
--- /dev/null
+++ b/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.Demo/.editorconfig
@@ -0,0 +1,4 @@
+[*.cs]
+
+# CS1591: Missing XML comment for publicly visible type or member
+dotnet_diagnostic.CS1591.severity = silent
diff --git a/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.Demo/Allegro.Extensions.Cqrs.Demo.csproj b/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.Demo/Allegro.Extensions.Cqrs.Demo.csproj
index 3be5c25..edd95d3 100644
--- a/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.Demo/Allegro.Extensions.Cqrs.Demo.csproj
+++ b/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.Demo/Allegro.Extensions.Cqrs.Demo.csproj
@@ -1,12 +1,9 @@
-
- true
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.FluentValidations/Allegro.Extensions.Cqrs.FluentValidations.csproj b/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.FluentValidations/Allegro.Extensions.Cqrs.FluentValidations.csproj
index e611d1b..c277a85 100644
--- a/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.FluentValidations/Allegro.Extensions.Cqrs.FluentValidations.csproj
+++ b/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.FluentValidations/Allegro.Extensions.Cqrs.FluentValidations.csproj
@@ -1,14 +1,13 @@
-
- Allegro.Extensions.Cqrs.FluentValidations
- Contains FluentVlidations extension for Allegro.Extensions.Cqrs
- true
-
-
-
-
-
-
-
-
-
+
+ Allegro.Extensions.Cqrs.FluentValidations
+ Contains FluentVlidations extension for Allegro.Extensions.Cqrs
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.FluentValidations/StartupExtensions.cs b/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.FluentValidations/StartupExtensions.cs
index 7379483..dde36af 100644
--- a/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.FluentValidations/StartupExtensions.cs
+++ b/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.FluentValidations/StartupExtensions.cs
@@ -27,8 +27,9 @@ public static IServiceCollection AddCqrsFluentValidations(
.AsImplementedInterfaces()
.WithScopedLifetime());
+ var callingAssembly = Assembly.GetCallingAssembly();
services
- .Scan(s => s.FromCallingAssembly()
+ .Scan(s => s.FromAssemblies(callingAssembly)
.AddClasses(
c => c.AssignableToAny(typeof(ICommandValidator<>), typeof(IQueryValidator<>)),
publicOnly)
diff --git a/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.Tests.Unit/Allegro.Extensions.Cqrs.Tests.Unit.csproj b/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.Tests.Unit/Allegro.Extensions.Cqrs.Tests.Unit.csproj
index 5e2da67..33f5227 100644
--- a/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.Tests.Unit/Allegro.Extensions.Cqrs.Tests.Unit.csproj
+++ b/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.Tests.Unit/Allegro.Extensions.Cqrs.Tests.Unit.csproj
@@ -1,20 +1,16 @@
-
- false
- true
-
-
-
-
-
-
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
-
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.csproj b/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.csproj
index 5d8d005..a36350a 100644
--- a/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.csproj
+++ b/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs.csproj
@@ -7,4 +7,7 @@
-
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs/InternalsVisibleTo.cs b/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs/InternalsVisibleTo.cs
deleted file mode 100644
index 27996fd..0000000
--- a/src/Allegro.Extensions.Cqrs/Allegro.Extensions.Cqrs/InternalsVisibleTo.cs
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright (c) PlaceholderCompany. All rights reserved.
-
-using System.Runtime.CompilerServices;
-
-[assembly: InternalsVisibleTo("Allegro.Extensions.Cqrs.Tests.Unit")]
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Cqrs/Directory.Packages.props b/src/Allegro.Extensions.Cqrs/Directory.Packages.props
new file mode 100644
index 0000000..c2013da
--- /dev/null
+++ b/src/Allegro.Extensions.Cqrs/Directory.Packages.props
@@ -0,0 +1,18 @@
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres.Tests.Integration/Allegro.Extensions.Dapper.Postgres.Tests.Integration.csproj b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres.Tests.Integration/Allegro.Extensions.Dapper.Postgres.Tests.Integration.csproj
index f29dc30..6a4a04f 100644
--- a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres.Tests.Integration/Allegro.Extensions.Dapper.Postgres.Tests.Integration.csproj
+++ b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres.Tests.Integration/Allegro.Extensions.Dapper.Postgres.Tests.Integration.csproj
@@ -1,19 +1,16 @@
-
- false
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres.Tests.Integration/Helpers/FakeStartup.cs b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres.Tests.Integration/Helpers/FakeStartup.cs
index e3003ed..95380f9 100644
--- a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres.Tests.Integration/Helpers/FakeStartup.cs
+++ b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres.Tests.Integration/Helpers/FakeStartup.cs
@@ -18,7 +18,8 @@ public FakeStartup(IConfiguration configuration)
public void ConfigureServices(IServiceCollection services)
{
- var connectionString = _configuration["PostgresSDK:ConnectionString"];
+ var connectionString = _configuration["PostgresSDK:ConnectionString"]
+ ?? throw new InvalidOperationException("Connection string not found in configuration.");
services
.AddDapperClient()
diff --git a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Abstractions/DbType.cs b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Abstractions/DbType.cs
index e214dec..4b1c00c 100644
--- a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Abstractions/DbType.cs
+++ b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Abstractions/DbType.cs
@@ -1,6 +1,5 @@
using System.Diagnostics.CodeAnalysis;
-#pragma warning disable CS1591
namespace Allegro.Extensions.Dapper.Postgres.Abstractions;
///
@@ -9,10 +8,12 @@ namespace Allegro.Extensions.Dapper.Postgres.Abstractions;
[SuppressMessage("Naming", "CA1720:Identifier contains type name", Justification = "Purpose of that enum")]
public enum DbType
{
+#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
Int,
BigInt,
Text,
Date,
Decimal,
Guid,
+#pragma warning restore CS1591
}
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Allegro.Extensions.Dapper.Postgres.csproj b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Allegro.Extensions.Dapper.Postgres.csproj
index b100248..0bfea5e 100644
--- a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Allegro.Extensions.Dapper.Postgres.csproj
+++ b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Allegro.Extensions.Dapper.Postgres.csproj
@@ -6,9 +6,9 @@
-
+
-
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/DapperPostgresBinaryCopyClient.cs b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/DapperPostgresBinaryCopyClient.cs
index 775e9d6..638eb2d 100644
--- a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/DapperPostgresBinaryCopyClient.cs
+++ b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/DapperPostgresBinaryCopyClient.cs
@@ -8,7 +8,7 @@
namespace Allegro.Extensions.Dapper.Postgres;
///
-internal class DapperPostgresBinaryCopyClient : IDapperPostgresBinaryCopyClient
+internal sealed class DapperPostgresBinaryCopyClient : IDapperPostgresBinaryCopyClient
{
private readonly PostgresDatabaseConnectionFactory _databaseConnectionFactory;
diff --git a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Exceptions/InvalidDbConnectionTypeException.cs b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Exceptions/InvalidDbConnectionTypeException.cs
index 1794a9c..047556e 100644
--- a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Exceptions/InvalidDbConnectionTypeException.cs
+++ b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Exceptions/InvalidDbConnectionTypeException.cs
@@ -1,14 +1,7 @@
-#pragma warning disable CS1591
-
namespace Allegro.Extensions.Dapper.Postgres.Exceptions;
///
/// Exception which indicates invalid underlying DbConnection type.
///
-public class InvalidDbConnectionTypeException : Exception
-{
- public InvalidDbConnectionTypeException(string expectedType)
- : base($"Invalid DbConnectionType, expected type: {expectedType}")
- {
- }
-}
\ No newline at end of file
+public class InvalidDbConnectionTypeException(string expectedType)
+ : Exception($"Invalid DbConnectionType, expected type: {expectedType}");
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Factories/PostgresDatabaseConnectionFactory.cs b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Factories/PostgresDatabaseConnectionFactory.cs
index 709b69b..e6f9eb6 100644
--- a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Factories/PostgresDatabaseConnectionFactory.cs
+++ b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.Postgres/Factories/PostgresDatabaseConnectionFactory.cs
@@ -8,7 +8,7 @@ namespace Allegro.Extensions.Dapper.Postgres.Factories;
///
/// Database connection factory for Postgres database.
///
-internal class PostgresDatabaseConnectionFactory : IDatabaseConnectionFactory
+internal sealed class PostgresDatabaseConnectionFactory : IDatabaseConnectionFactory
{
private readonly DatabaseConfiguration _databaseConfiguration;
diff --git a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.csproj b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.csproj
index b63e805..3814657 100644
--- a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.csproj
+++ b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper.csproj
@@ -6,7 +6,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper/DapperClient.cs b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper/DapperClient.cs
index f713148..da01537 100644
--- a/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper/DapperClient.cs
+++ b/src/Allegro.Extensions.Dapper/Allegro.Extensions.Dapper/DapperClient.cs
@@ -8,7 +8,7 @@ namespace Allegro.Extensions.Dapper;
/// Database client which initializes connection to a database,
/// performs operation and makes sure that connection is closed.
///
-internal class DapperClient : IDapperClient
+internal sealed class DapperClient : IDapperClient
{
private readonly IDatabaseConnectionFactory _databaseConnectionFactory;
diff --git a/src/Allegro.Extensions.Dapper/Directory.Packages.props b/src/Allegro.Extensions.Dapper/Directory.Packages.props
new file mode 100644
index 0000000..8dfec01
--- /dev/null
+++ b/src/Allegro.Extensions.Dapper/Directory.Packages.props
@@ -0,0 +1,18 @@
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.Abstractions/Allegro.Extensions.DependencyCall.Abstractions.csproj b/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.Abstractions/Allegro.Extensions.DependencyCall.Abstractions.csproj
index 40418c3..480b8c6 100644
--- a/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.Abstractions/Allegro.Extensions.DependencyCall.Abstractions.csproj
+++ b/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.Abstractions/Allegro.Extensions.DependencyCall.Abstractions.csproj
@@ -2,7 +2,6 @@
Allegro.Extensions.DependencyCall.Abstractions
Contains DependencyCall package abstractions
- ${NoWarn},CS8618,SA1636
-
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.Metrics.Prometheus/Allegro.Extensions.DependencyCall.Metrics.Prometheus.csproj b/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.Metrics.Prometheus/Allegro.Extensions.DependencyCall.Metrics.Prometheus.csproj
index bdd5f99..d9611fe 100644
--- a/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.Metrics.Prometheus/Allegro.Extensions.DependencyCall.Metrics.Prometheus.csproj
+++ b/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.Metrics.Prometheus/Allegro.Extensions.DependencyCall.Metrics.Prometheus.csproj
@@ -2,17 +2,16 @@
Allegro.Extensions.DependencyCall.Metrics.Prometheus
Contains prometheus based metrics for dependency call
- ${NoWarn},CS8618,SA1636
-
-
-
+
+
+
+
-
-
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.Tests.Unit/Allegro.Extensions.DependencyCall.Tests.Unit.csproj b/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.Tests.Unit/Allegro.Extensions.DependencyCall.Tests.Unit.csproj
index 4ae1499..9cac6dc 100644
--- a/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.Tests.Unit/Allegro.Extensions.DependencyCall.Tests.Unit.csproj
+++ b/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.Tests.Unit/Allegro.Extensions.DependencyCall.Tests.Unit.csproj
@@ -1,19 +1,15 @@
-
- false
- ${NoWarn},CS8618,CS1591
-
-
-
-
-
-
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.csproj b/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.csproj
index 78ed55c..e3f96c5 100644
--- a/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.csproj
+++ b/src/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall/Allegro.Extensions.DependencyCall.csproj
@@ -3,19 +3,16 @@
Allegro.Extensions.DependencyCall
Contains DependencyCall tool
- ${NoWarn},CS8618,SA1636
-
-
-
-
-
+
-
-
+
+
+
+
diff --git a/src/Allegro.Extensions.DependencyCall/Directory.Packages.props b/src/Allegro.Extensions.DependencyCall/Directory.Packages.props
new file mode 100644
index 0000000..e96586e
--- /dev/null
+++ b/src/Allegro.Extensions.DependencyCall/Directory.Packages.props
@@ -0,0 +1,18 @@
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials.Tests.Unit/Allegro.Extensions.Financials.Tests.Unit.csproj b/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials.Tests.Unit/Allegro.Extensions.Financials.Tests.Unit.csproj
index 5755f19..2d5413f 100644
--- a/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials.Tests.Unit/Allegro.Extensions.Financials.Tests.Unit.csproj
+++ b/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials.Tests.Unit/Allegro.Extensions.Financials.Tests.Unit.csproj
@@ -1,18 +1,14 @@
-
- false
- false
-
-
-
-
-
-
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials.Tests.Unit/Extensions/MoneyExtensionsTests.cs b/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials.Tests.Unit/Extensions/MoneyExtensionsTests.cs
index b12b767..959e9d9 100644
--- a/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials.Tests.Unit/Extensions/MoneyExtensionsTests.cs
+++ b/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials.Tests.Unit/Extensions/MoneyExtensionsTests.cs
@@ -76,7 +76,7 @@ public StructWithMoney(decimal money)
}
}
- private class ClassWithMoney
+ private sealed class ClassWithMoney
{
public Money Money { get; }
diff --git a/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials/ValueObjects/Currency.cs b/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials/ValueObjects/Currency.cs
index 712937c..d73c332 100644
--- a/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials/ValueObjects/Currency.cs
+++ b/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials/ValueObjects/Currency.cs
@@ -1,5 +1,4 @@
using System.Runtime.Serialization;
-#pragma warning disable CS1591
namespace Allegro.Extensions.Financials.ValueObjects;
@@ -9,6 +8,8 @@ namespace Allegro.Extensions.Financials.ValueObjects;
///
public enum Currency
{
+#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
[EnumMember(Value = "PLN")]
PLN = 985,
+#pragma warning restore CS1591
}
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials/ValueObjects/Money.Operators.cs b/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials/ValueObjects/Money.Operators.cs
index 7a4f410..147d57c 100644
--- a/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials/ValueObjects/Money.Operators.cs
+++ b/src/Allegro.Extensions.Financials/Allegro.Extensions.Financials/ValueObjects/Money.Operators.cs
@@ -1,9 +1,8 @@
-#pragma warning disable CS1591
-
namespace Allegro.Extensions.Financials.ValueObjects;
public partial record Money
{
+#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
// Money & Money
public static Money operator +(Money? m1, Money? m2)
=> Calculate(m1?.Amount, m1?.Currency, m2?.Amount, m2?.Currency, CalculateOperator.Add);
@@ -68,6 +67,7 @@ public partial record Money
public static bool operator >=(Money? m1, decimal? d2)
=> Compare(m1?.Amount, m1?.Currency, d2, c2: null, CompareOperator.MoreOrEquals);
+#pragma warning restore CS1591
private enum CalculateOperator
{
diff --git a/src/Allegro.Extensions.Financials/Directory.Packages.props b/src/Allegro.Extensions.Financials/Directory.Packages.props
new file mode 100644
index 0000000..665d875
--- /dev/null
+++ b/src/Allegro.Extensions.Financials/Directory.Packages.props
@@ -0,0 +1,13 @@
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Globalization/Allegro.Extensions.Globalization.Tests/Allegro.Extensions.Globalization.Tests.csproj b/src/Allegro.Extensions.Globalization/Allegro.Extensions.Globalization.Tests/Allegro.Extensions.Globalization.Tests.csproj
index 5016838..c06827b 100644
--- a/src/Allegro.Extensions.Globalization/Allegro.Extensions.Globalization.Tests/Allegro.Extensions.Globalization.Tests.csproj
+++ b/src/Allegro.Extensions.Globalization/Allegro.Extensions.Globalization.Tests/Allegro.Extensions.Globalization.Tests.csproj
@@ -1,19 +1,14 @@
-
- false
- AnyCPU;x64
- false
-
-
-
-
-
-
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Allegro.Extensions.Globalization/Allegro.Extensions.Globalization/Allegro.Extensions.Globalization.csproj b/src/Allegro.Extensions.Globalization/Allegro.Extensions.Globalization/Allegro.Extensions.Globalization.csproj
index f52632a..ed964d9 100644
--- a/src/Allegro.Extensions.Globalization/Allegro.Extensions.Globalization/Allegro.Extensions.Globalization.csproj
+++ b/src/Allegro.Extensions.Globalization/Allegro.Extensions.Globalization/Allegro.Extensions.Globalization.csproj
@@ -1,4 +1,4 @@
-
+
Allegro.Extensions.Globalization
diff --git a/src/Allegro.Extensions.Globalization/Directory.Packages.props b/src/Allegro.Extensions.Globalization/Directory.Packages.props
new file mode 100644
index 0000000..5c5a730
--- /dev/null
+++ b/src/Allegro.Extensions.Globalization/Directory.Packages.props
@@ -0,0 +1,13 @@
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.Abstractions/Allegro.Extensions.Identifiers.Abstractions.csproj b/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.Abstractions/Allegro.Extensions.Identifiers.Abstractions.csproj
index 01018d7..0356306 100644
--- a/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.Abstractions/Allegro.Extensions.Identifiers.Abstractions.csproj
+++ b/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.Abstractions/Allegro.Extensions.Identifiers.Abstractions.csproj
@@ -3,11 +3,10 @@
Allegro.Extensions.Identifiers.Abstractions
Contains strongly typed identifiers abstractions.
- CS1574
-
-
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.AspNetCore/Allegro.Extensions.Identifiers.AspNetCore.csproj b/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.AspNetCore/Allegro.Extensions.Identifiers.AspNetCore.csproj
index 98c250c..0289e7d 100644
--- a/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.AspNetCore/Allegro.Extensions.Identifiers.AspNetCore.csproj
+++ b/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.AspNetCore/Allegro.Extensions.Identifiers.AspNetCore.csproj
@@ -3,13 +3,12 @@
Allegro.Extensions.Identifiers.AspNetCore
Contains strongly typed identifiers extensions for swagger.
- CS1574
-
+
-
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.Demo/.editorconfig b/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.Demo/.editorconfig
new file mode 100644
index 0000000..6902e1a
--- /dev/null
+++ b/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.Demo/.editorconfig
@@ -0,0 +1,3 @@
+[*.cs]
+# CS1591: Missing XML comment for publicly visible type or member
+dotnet_diagnostic.CS1591.severity = none
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.Demo/Allegro.Extensions.Identifiers.Demo.csproj b/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.Demo/Allegro.Extensions.Identifiers.Demo.csproj
index 69f4a94..fbc0430 100644
--- a/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.Demo/Allegro.Extensions.Identifiers.Demo.csproj
+++ b/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.Demo/Allegro.Extensions.Identifiers.Demo.csproj
@@ -1,13 +1,10 @@
-
- false
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.Demo/Identifiers/OrderId.cs b/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.Demo/Identifiers/OrderId.cs
index fb3f376..b7ec865 100644
--- a/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.Demo/Identifiers/OrderId.cs
+++ b/src/Allegro.Extensions.Identifiers/Allegro.Extensions.Identifiers.Demo/Identifiers/OrderId.cs
@@ -1,6 +1,3 @@
-// Copyright (c) PlaceholderCompany. All rights reserved.
-#pragma warning disable 1591
-
using Allegro.Extensions.Identifiers.Abstractions;
using Meziantou.Framework.Annotations;
diff --git a/src/Allegro.Extensions.Identifiers/Directory.Packages.props b/src/Allegro.Extensions.Identifiers/Directory.Packages.props
new file mode 100644
index 0000000..e0a3840
--- /dev/null
+++ b/src/Allegro.Extensions.Identifiers/Directory.Packages.props
@@ -0,0 +1,11 @@
+
+
+ true
+ true
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes.Tests.Unit/Allegro.Extensions.NullableReferenceTypes.Tests.Unit.csproj b/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes.Tests.Unit/Allegro.Extensions.NullableReferenceTypes.Tests.Unit.csproj
index 390acb2..5c556ab 100644
--- a/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes.Tests.Unit/Allegro.Extensions.NullableReferenceTypes.Tests.Unit.csproj
+++ b/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes.Tests.Unit/Allegro.Extensions.NullableReferenceTypes.Tests.Unit.csproj
@@ -1,22 +1,17 @@
-
- false
- ${NoWarn},CS8618
- false
-
-
-
-
-
-
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
\ No newline at end of file
diff --git a/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes.Tests.Unit/Validators/ObjectValidatorTests.cs b/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes.Tests.Unit/Validators/ObjectValidatorTests.cs
index 69400c1..1c1cf7a 100644
--- a/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes.Tests.Unit/Validators/ObjectValidatorTests.cs
+++ b/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes.Tests.Unit/Validators/ObjectValidatorTests.cs
@@ -267,65 +267,65 @@ public record StaticConstructorMethodCircularDependencyObject(decimal Value)
public static StaticConstructorMethodCircularDependencyObject Empty => new(0);
}
- private class NonNullableObject
+ private sealed class NonNullableObject
{
public int Number { get; init; }
- public string String { get; init; }
+ public required string String { get; init; }
- public string[] StringArray { get; init; }
+ public required string[] StringArray { get; init; }
public DateTimeOffset Date { get; init; }
- public NonNullableObjectChild NonNullable { get; init; }
+ public required NonNullableObjectChild NonNullable { get; init; }
- public IEnumerable NonNullableIEnumerable { get; init; }
+ public required IEnumerable NonNullableIEnumerable { get; init; }
- public ICollection NonNullableICollection { get; init; }
+ public required ICollection NonNullableICollection { get; init; }
- public IList NonNullableIList { get; init; }
+ public required IList NonNullableIList { get; init; }
- public List NonNullableList { get; init; }
+ public required List NonNullableList { get; init; }
- public NonNullableObjectChild[] NonNullableArray { get; init; }
+ public required NonNullableObjectChild[] NonNullableArray { get; init; }
- public IDictionary NonNullableIDictionary { get; init; }
+ public required IDictionary NonNullableIDictionary { get; init; }
- public Dictionary NonNullableDictionary { get; init; }
+ public required Dictionary NonNullableDictionary { get; init; }
- public Dictionary> NonNullableDictionaryOfIEnumerable { get; init; }
+ public required Dictionary> NonNullableDictionaryOfIEnumerable { get; init; }
}
- private record NonNullableKey
+ private sealed record NonNullableKey
{
public int Number { get; init; }
- public string String { get; init; }
+ public required string String { get; init; }
}
- private class PrivatePropertiesObject
+ private sealed class PrivatePropertiesObject
{
-#pragma warning restore IDE0051
- public string PublicText { get; init; }
+ public required string PublicText { get; init; }
#pragma warning disable IDE0051
private int Number { get; init; }
private int? NumberNullable { get; init; }
- private string String { get; init; }
+ private string String { get; init; } = null!;
private string? StringNullable { get; init; }
+#pragma warning restore IDE0051
}
- private class NonNullableObjectChild
+ private sealed class NonNullableObjectChild
{
public int Number { get; init; }
- public string String { get; init; }
+ public required string String { get; init; }
}
- private class NullableObject
+ private sealed class NullableObject
{
public int? Number { get; init; }
@@ -352,14 +352,14 @@ private class NullableObject
public Dictionary?>? NullableDictionaryOfIEnumerable { get; init; }
}
- private class NullableKey
+ private sealed class NullableKey
{
public int? Number { get; init; }
public string? String { get; init; }
}
- private class NullableObjectChild
+ private sealed class NullableObjectChild
{
public int? Number { get; init; }
diff --git a/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes.csproj b/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes.csproj
index 62d811d..0dde5b6 100644
--- a/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes.csproj
+++ b/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes.csproj
@@ -3,7 +3,6 @@
Allegro.Extensions.NullableReferenceTypes
Contains useful classes and extensions for projects which use NRT.
- ${NoWarn},CS8618
\ No newline at end of file
diff --git a/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes/Validators/ObjectValidator.cs b/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes/Validators/ObjectValidator.cs
index f31c61b..50b6e28 100644
--- a/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes/Validators/ObjectValidator.cs
+++ b/src/Allegro.Extensions.NullableReferenceTypes/Allegro.Extensions.NullableReferenceTypes/Validators/ObjectValidator.cs
@@ -1,5 +1,7 @@
using System.Collections;
using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Reflection;
namespace Allegro.Extensions.NullableReferenceTypes.Validators;
@@ -69,11 +71,11 @@ private static bool TryValidateCollections(Type type, object instance, string pr
var result = false;
if (type.IsArray)
{
- var elementType = type.GetElementType();
+ var elementType = type.GetElementType() ?? throw new UnreachableException("Array element type cannot be null.");
var index = 0;
foreach (var item in (Array)instance)
{
- Validate(elementType!, item, propertyPath + $"[{index}]");
+ Validate(elementType, item, propertyPath + $"[{index}]");
index++;
}
@@ -87,8 +89,8 @@ private static bool TryValidateCollections(Type type, object instance, string pr
var dictionary = (IDictionary)instance;
foreach (DictionaryEntry item in dictionary)
{
- Validate(underlyingKeyType!, item.Key, propertyPath + $"[{item.Key}]");
- Validate(underlyingValueType!, item.Value, propertyPath + $"[{item.Key}]");
+ Validate(underlyingKeyType, item.Key, propertyPath + $"[{item.Key}]");
+ Validate(underlyingValueType, item.Value, propertyPath + $"[{item.Key}]");
}
result = true;
@@ -99,7 +101,7 @@ private static bool TryValidateCollections(Type type, object instance, string pr
var index = 0;
foreach (var item in collection)
{
- Validate(underlyingType!, item, propertyPath + $"[{index}]");
+ Validate(underlyingType, item, propertyPath + $"[{index}]");
index++;
}
@@ -109,12 +111,11 @@ private static bool TryValidateCollections(Type type, object instance, string pr
return result;
}
- private static bool IsEnumerableType(Type type, out Type? underlyingType)
+ private static bool IsEnumerableType(Type type, [NotNullWhen(true)] out Type? underlyingType)
{
- underlyingType = null;
-
if (!type.IsGenericType || !IsAssignableToGenericType(type, typeof(IEnumerable<>)))
{
+ underlyingType = null;
return false;
}
@@ -123,13 +124,12 @@ private static bool IsEnumerableType(Type type, out Type? underlyingType)
return true;
}
- private static bool IsDictionaryType(Type type, out Type? underlyingKeyType, out Type? underlyingValueType)
+ private static bool IsDictionaryType(Type type, [NotNullWhen(true)] out Type? underlyingKeyType, [NotNullWhen(true)] out Type? underlyingValueType)
{
- underlyingKeyType = null;
- underlyingValueType = null;
-
if (!type.IsGenericType || !IsAssignableToGenericType(type, typeof(IDictionary<,>)))
{
+ underlyingKeyType = null;
+ underlyingValueType = null;
return false;
}
@@ -171,20 +171,19 @@ private static bool IsNullable(PropertyInfo property)
var nullable = property.CustomAttributes
.FirstOrDefault(x => x.AttributeType.FullName == "System.Runtime.CompilerServices.NullableAttribute");
- if (nullable != null && nullable.ConstructorArguments.Count == 1)
+ if (nullable is { ConstructorArguments: [{ Value: { } } attributeArgument] })
{
- var attributeArgument = nullable.ConstructorArguments[0];
if (attributeArgument.ArgumentType == typeof(byte[]))
{
- var args = (ReadOnlyCollection)attributeArgument.Value!;
- if (args.Count > 0 && args[0].ArgumentType == typeof(byte))
+ var args = (ReadOnlyCollection)attributeArgument.Value;
+ if (args is [{ Value: { } } arg, ..] && arg.ArgumentType == typeof(byte))
{
- return (byte)args[0].Value! == 2;
+ return (byte)arg.Value == 2;
}
}
else if (attributeArgument.ArgumentType == typeof(byte))
{
- return (byte)attributeArgument.Value! == 2;
+ return (byte)attributeArgument.Value == 2;
}
}
@@ -194,11 +193,9 @@ private static bool IsNullable(PropertyInfo property)
.FirstOrDefault(
x =>
x.AttributeType.FullName == "System.Runtime.CompilerServices.NullableContextAttribute");
- if (context != null &&
- context.ConstructorArguments.Count == 1 &&
- context.ConstructorArguments[0].ArgumentType == typeof(byte))
+ if (context is { ConstructorArguments: [{ Value: { } value } argument] } && argument.ArgumentType == typeof(byte))
{
- return (byte)context.ConstructorArguments[0].Value! == 2;
+ return (byte)value == 2;
}
}
diff --git a/src/Allegro.Extensions.NullableReferenceTypes/Directory.Packages.props b/src/Allegro.Extensions.NullableReferenceTypes/Directory.Packages.props
new file mode 100644
index 0000000..446e247
--- /dev/null
+++ b/src/Allegro.Extensions.NullableReferenceTypes/Directory.Packages.props
@@ -0,0 +1,14 @@
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.RateLimiting/Allegro.Extensions.RateLimiting.Tests.Unit/Allegro.Extensions.RateLimiting.Tests.Unit.csproj b/src/Allegro.Extensions.RateLimiting/Allegro.Extensions.RateLimiting.Tests.Unit/Allegro.Extensions.RateLimiting.Tests.Unit.csproj
index 604ad73..9402a70 100644
--- a/src/Allegro.Extensions.RateLimiting/Allegro.Extensions.RateLimiting.Tests.Unit/Allegro.Extensions.RateLimiting.Tests.Unit.csproj
+++ b/src/Allegro.Extensions.RateLimiting/Allegro.Extensions.RateLimiting.Tests.Unit/Allegro.Extensions.RateLimiting.Tests.Unit.csproj
@@ -1,18 +1,14 @@
-
- false
- false
-
-
-
-
-
-
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Allegro.Extensions.RateLimiting/Allegro.Extensions.RateLimiting/RateLimiter.cs b/src/Allegro.Extensions.RateLimiting/Allegro.Extensions.RateLimiting/RateLimiter.cs
index 0938814..f97f481 100644
--- a/src/Allegro.Extensions.RateLimiting/Allegro.Extensions.RateLimiting/RateLimiter.cs
+++ b/src/Allegro.Extensions.RateLimiting/Allegro.Extensions.RateLimiting/RateLimiter.cs
@@ -12,7 +12,7 @@ namespace Allegro.Extensions.RateLimiting
/// Also first execution of each unique operationName will be synchronous until its weight is calculated, to prevent
/// any chance of exceeding the MaxRate.
///
- public class RateLimiter : IRateLimiterWithVariableRate
+ public sealed class RateLimiter : IRateLimiterWithVariableRate, IDisposable
{
private readonly SemaphoreSlim _delaySemaphore = new(1, 1);
private readonly SemaphoreSlim _logUsageSemaphore = new(1, 1);
@@ -174,6 +174,13 @@ public async Task ExecuteWithEstimatedWeightAsync(
return result;
}
+ ///
+ public void Dispose()
+ {
+ _delaySemaphore.Dispose();
+ _logUsageSemaphore.Dispose();
+ }
+
private async Task CalculateWeightAndLogUsage(
string operationName,
T result,
diff --git a/src/Allegro.Extensions.RateLimiting/Directory.Packages.props b/src/Allegro.Extensions.RateLimiting/Directory.Packages.props
new file mode 100644
index 0000000..5c5a730
--- /dev/null
+++ b/src/Allegro.Extensions.RateLimiting/Directory.Packages.props
@@ -0,0 +1,13 @@
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Serialization/Allegro.Extensions.Serialization.Tests.Unit/Allegro.Extensions.Serialization.Tests.Unit.csproj b/src/Allegro.Extensions.Serialization/Allegro.Extensions.Serialization.Tests.Unit/Allegro.Extensions.Serialization.Tests.Unit.csproj
index 23d096a..4d50f0c 100644
--- a/src/Allegro.Extensions.Serialization/Allegro.Extensions.Serialization.Tests.Unit/Allegro.Extensions.Serialization.Tests.Unit.csproj
+++ b/src/Allegro.Extensions.Serialization/Allegro.Extensions.Serialization.Tests.Unit/Allegro.Extensions.Serialization.Tests.Unit.csproj
@@ -1,19 +1,14 @@
-
- false
- AnyCPU;x64
- false
-
-
-
-
-
-
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Allegro.Extensions.Serialization/Allegro.Extensions.Serialization/Extensions/EnumHelper.cs b/src/Allegro.Extensions.Serialization/Allegro.Extensions.Serialization/Extensions/EnumHelper.cs
index e61ed04..ac918f4 100644
--- a/src/Allegro.Extensions.Serialization/Allegro.Extensions.Serialization/Extensions/EnumHelper.cs
+++ b/src/Allegro.Extensions.Serialization/Allegro.Extensions.Serialization/Extensions/EnumHelper.cs
@@ -1,4 +1,5 @@
using System.Collections.Concurrent;
+using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.Serialization;
@@ -28,19 +29,19 @@ public static TEnum Parse(string enumValue)
}
///
- /// Tires to parse enum value to TEnum type
+ /// Tires to parse enum value to TEnum type
///
- public static bool TryParse(string enumValue, out TEnum? result)
+ public static bool TryParse(string enumValue, [NotNullWhen(true)] out TEnum? result)
where TEnum : struct, Enum
{
var map = GetValueMap();
- if (!map.ContainsKey(enumValue))
+ if (!map.TryGetValue(enumValue, out var value))
{
result = null;
return false;
}
- result = (TEnum)map[enumValue].EnumValue;
+ result = (TEnum)value.EnumValue;
return true;
}
diff --git a/src/Allegro.Extensions.Serialization/Directory.Packages.props b/src/Allegro.Extensions.Serialization/Directory.Packages.props
new file mode 100644
index 0000000..5c5a730
--- /dev/null
+++ b/src/Allegro.Extensions.Serialization/Directory.Packages.props
@@ -0,0 +1,13 @@
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators.Tests.Unit/Allegro.Extensions.Validators.Tests.Unit.csproj b/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators.Tests.Unit/Allegro.Extensions.Validators.Tests.Unit.csproj
index edbcff4..02069cd 100644
--- a/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators.Tests.Unit/Allegro.Extensions.Validators.Tests.Unit.csproj
+++ b/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators.Tests.Unit/Allegro.Extensions.Validators.Tests.Unit.csproj
@@ -1,19 +1,14 @@
-
- false
- ${NoWarn},CS8618
- false
-
-
-
-
-
-
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators.Tests.Unit/InputValidatorTests.cs b/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators.Tests.Unit/InputValidatorTests.cs
index a3f4120..eb4718e 100644
--- a/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators.Tests.Unit/InputValidatorTests.cs
+++ b/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators.Tests.Unit/InputValidatorTests.cs
@@ -9,9 +9,9 @@ public class InputValidatorTests
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
- public void EnsureHasValue_WhenInvalidInput_ShouldThrowArgumentNullException(string test)
+ public void EnsureHasValue_WhenInvalidInput_ShouldThrowArgumentNullException(string? test)
{
- var act = () => InputValidator.EnsureHasValue(test);
+ var act = () => InputValidator.EnsureHasValue(test!);
act.Should().Throw();
}
diff --git a/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators/Allegro.Extensions.Validators.csproj b/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators/Allegro.Extensions.Validators.csproj
index 93d3d8c..fc389e6 100644
--- a/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators/Allegro.Extensions.Validators.csproj
+++ b/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators/Allegro.Extensions.Validators.csproj
@@ -3,14 +3,13 @@
Allegro.Extensions.Validators
Contains useful classes and extensions validators.
- ${NoWarn},CS8618,SA1636
-
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators/StartupExtensions.cs b/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators/StartupExtensions.cs
index 5564e82..71b53aa 100644
--- a/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators/StartupExtensions.cs
+++ b/src/Allegro.Extensions.Validators/Allegro.Extensions.Validators/StartupExtensions.cs
@@ -51,7 +51,7 @@ public static IServiceCollection RegisterFluentValidator(
///
public static OptionsBuilder AddOptionsWithFluentValidation(
this IServiceCollection services,
- string? configurationSection)
+ string configurationSection)
where TOptions : class
where TValidator : class, IValidator
{
diff --git a/src/Allegro.Extensions.Validators/Directory.Packages.props b/src/Allegro.Extensions.Validators/Directory.Packages.props
new file mode 100644
index 0000000..e481d0a
--- /dev/null
+++ b/src/Allegro.Extensions.Validators/Directory.Packages.props
@@ -0,0 +1,18 @@
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 9667540..db066f5 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -3,14 +3,17 @@
net8.0
false
+ true
+ $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), version.xml))
+ $([MSBuild]::EnsureTrailingSlash($(SolutionDir)))
true
- $(SolutionDir)\bin\$(MSBuildProjectName)
- $(SolutionDir)\obj\$(MSBuildProjectName)
- $(SolutionDir)\nuget
+ $(SolutionDir)bin\$(MSBuildProjectName)
+ $(SolutionDir)obj\$(MSBuildProjectName)
+ $(SolutionDir)nuget
\ No newline at end of file
diff --git a/src/Package.Build.props b/src/Package.Build.props
index 08b540e..8f79fcd 100644
--- a/src/Package.Build.props
+++ b/src/Package.Build.props
@@ -14,9 +14,9 @@
-
-
+
+
-
+
\ No newline at end of file
diff --git a/src/nuget.config b/src/nuget.config
new file mode 100644
index 0000000..a82e4bb
--- /dev/null
+++ b/src/nuget.config
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file