diff --git a/CustomAnalysisRules.ruleset b/CustomAnalysisRules.ruleset index 72d55b1330..b51b4865c3 100644 --- a/CustomAnalysisRules.ruleset +++ b/CustomAnalysisRules.ruleset @@ -2,12 +2,18 @@ + + + + + + diff --git a/Directory.Build.props b/Directory.Build.props index 798a01206c..dcb6d51a43 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -19,7 +19,7 @@ true https://github.com/microsoft/fhir-server $(MSBuildThisFileDirectory)\CodeCoverage.runsettings - net8.0;net6.0 + net9.0;net8.0;net6.0 true true diff --git a/Directory.Packages.props b/Directory.Packages.props index 8d8b58cdd9..4e0928ae47 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,10 +1,40 @@ - 7.1.183 + 8.0.30 + 4.3.0 5.4.0 5.3.0 + + + + + + 12.4.1 + 8.0.2 + 8.0 + 6.0 + + + + + + 12.4.1 + 8.0.2 + 8.0 + 8.0 + + + + + 12.4.1 + 9.0.1 + 9.0.0 + 9.0.0 + + + @@ -17,22 +47,9 @@ - - - - - 8.0.0 - - - - - 6.0.23 - - - - + @@ -59,7 +76,7 @@ - + @@ -70,22 +87,23 @@ - - - - - - - - - - - + + + + + + + + + + + + - - - - + + + + @@ -105,7 +123,7 @@ - + @@ -117,9 +135,8 @@ - - - + + diff --git a/build/build-variables.yml b/build/build-variables.yml index 47e21a392b..75699622d0 100644 --- a/build/build-variables.yml +++ b/build/build-variables.yml @@ -5,7 +5,7 @@ variables: buildConfiguration: 'Release' publicDockerImagePlatforms: 'linux/amd64,linux/arm64' testDockerImagePlatforms: 'linux/amd64' - defaultBuildFramework: 'net8.0' + defaultBuildFramework: 'net9.0' azureSubscriptionEndpoint: 'docker-build' azureContainerRegistryName: 'healthplatformregistry' azureContainerRegistry: '$(azureContainerRegistryName).azurecr.io' diff --git a/build/ci-pipeline.yml b/build/ci-pipeline.yml index 5aa36ae032..f98d0970de 100644 --- a/build/ci-pipeline.yml +++ b/build/ci-pipeline.yml @@ -65,7 +65,7 @@ stages: majorMinorPatch: $[stageDependencies.UpdateVersion.Semver.outputs['SetVariablesFromGitVersion.majorMinorPatch']] nuGetVersion: $[stageDependencies.UpdateVersion.Semver.outputs['SetVariablesFromGitVersion.nuGetVersion']] jobs: - - job: Windows_dotnet8 + - job: Windows_dotnet9 pool: name: '$(DefaultWindowsPool)' steps: @@ -74,6 +74,13 @@ stages: targetBuildFramework: $(defaultBuildFramework) unitTest: false codeCoverage: true + - job: Windows_dotnet8 + pool: + name: '$(DefaultWindowsPool)' + steps: + - template: ./jobs/build.yml + parameters: + targetBuildFramework: 'net8.0' - job: Linux_dotnet6 pool: name: '$(DefaultLinuxPool)' diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index 5c3ff0de08..38d56d687c 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -1,11 +1,9 @@ # --platform tells docker to always use the host platform for the build not the target platform. Runtime container will use target platform. -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0.403-cbl-mariner2.0 AS build +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0.102-azurelinux3.0 AS build ARG TARGETARCH ARG FHIR_VERSION ARG ASSEMBLY_VER -RUN groupadd nonroot -g 1000 && useradd -r -M -s /sbin/nologin -g nonroot -c nonroot nonroot -u 998 - WORKDIR /repo COPY .editorconfig \ @@ -76,10 +74,10 @@ RUN dotnet restore ./src/Microsoft.Health.Fhir.${FHIR_VERSION}.Web/Microsoft.Hea COPY . . -RUN dotnet publish /repo/src/Microsoft.Health.Fhir.${FHIR_VERSION}.Web/Microsoft.Health.Fhir.${FHIR_VERSION}.Web.csproj -o "/build" --no-restore -p:AssemblyVersion="${ASSEMBLY_VER}" -p:FileVersion="${ASSEMBLY_VER}" -p:Version="${ASSEMBLY_VER}" -f net8.0 -a $TARGETARCH +RUN dotnet publish /repo/src/Microsoft.Health.Fhir.${FHIR_VERSION}.Web/Microsoft.Health.Fhir.${FHIR_VERSION}.Web.csproj -o "/build" --no-restore -p:AssemblyVersion="${ASSEMBLY_VER}" -p:FileVersion="${ASSEMBLY_VER}" -p:Version="${ASSEMBLY_VER}" -f net9.0 -a $TARGETARCH # Implicitly uses the target platform for the runtime image. -FROM mcr.microsoft.com/dotnet/aspnet:8.0.11-cbl-mariner2.0 AS runtime +FROM mcr.microsoft.com/dotnet/aspnet:9.0.1-azurelinux3.0 AS runtime ARG FHIR_VERSION @@ -90,9 +88,6 @@ RUN tdnf clean all && tdnf repolist --refresh && tdnf update -y && tdnf clean al RUN tdnf install icu -y && \ tdnf clean all -COPY --from=build /etc/group /etc/group -COPY --from=build /etc/passwd /etc/passwd - ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ ASPNETCORE_URLS=http://+:8080 diff --git a/build/dotnet6-compat/global.json b/build/dotnet6-compat/global.json index 6e6e5445c2..2b6994f451 100644 --- a/build/dotnet6-compat/global.json +++ b/build/dotnet6-compat/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "6.0.427" + "version": "6.0.428" } } diff --git a/build/dotnet8-compat/global.json b/build/dotnet8-compat/global.json new file mode 100644 index 0000000000..001a7a2552 --- /dev/null +++ b/build/dotnet8-compat/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "8.0.405" + } +} diff --git a/build/jobs/analyze.yml b/build/jobs/analyze.yml index 2ccbb08ccd..f8e2a8c7c7 100644 --- a/build/jobs/analyze.yml +++ b/build/jobs/analyze.yml @@ -110,7 +110,7 @@ steps: inputs: userProvideBuildInfo: 'msBuildInfo' msBuildArchitecture: 'DotNetCore' - msBuildCommandline: 'dotnet build $(Build.SourcesDirectory)/Microsoft.Health.Fhir.sln --configuration $(buildConfiguration) -p:ContinuousIntegrationBuild=true -f net8.0' + msBuildCommandline: 'dotnet build $(Build.SourcesDirectory)/Microsoft.Health.Fhir.sln --configuration $(buildConfiguration) -p:ContinuousIntegrationBuild=true -f net9.0' - task: BinSkim@4 inputs: diff --git a/build/jobs/run-tests.yml b/build/jobs/run-tests.yml index d078ac0ff6..1b90ee4be3 100644 --- a/build/jobs/run-tests.yml +++ b/build/jobs/run-tests.yml @@ -119,7 +119,7 @@ jobs: workingDirectory: "$(System.ArtifactsDirectory)" testRunTitle: '${{ parameters.version }} Integration' env: - 'SqlServer:ConnectionString': 'Server=tcp:${{ parameters.integrationSqlServerName }}.database.windows.net,1433;Initial Catalog=master;Persist Security Info=False;Authentication=Active Directory Workload Identity;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;User Id=$(AZURESUBSCRIPTION_CLIENT_ID);' + 'SqlServer:ConnectionString': 'Server=tcp:${{ parameters.integrationSqlServerName }}.database.windows.net,1433;Initial Catalog=master;Persist Security Info=False;Authentication=ActiveDirectoryWorkloadIdentity;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;User Id=$(AZURESUBSCRIPTION_CLIENT_ID);' 'AZURESUBSCRIPTION_CLIENT_ID': '$(AZURESUBSCRIPTION_CLIENT_ID)' 'AZURESUBSCRIPTION_TENANT_ID': '$(AZURESUBSCRIPTION_TENANT_ID)' 'AZURESUBSCRIPTION_SERVICE_CONNECTION_ID': '$(AZURESUBSCRIPTION_SERVICE_CONNECTION_ID)' diff --git a/build/pr-pipeline.yml b/build/pr-pipeline.yml index 71b30c9433..7e4d90f6c3 100644 --- a/build/pr-pipeline.yml +++ b/build/pr-pipeline.yml @@ -37,7 +37,7 @@ stages: majorMinorPatch: $[stageDependencies.UpdateVersion.Semver.outputs['SetVariablesFromGitVersion.majorMinorPatch']] nuGetVersion: $[stageDependencies.UpdateVersion.Semver.outputs['SetVariablesFromGitVersion.nuGetVersion']] jobs: - - job: Windows_dotnet8 + - job: Windows_dotnet9 pool: name: '$(DefaultWindowsPool)' steps: @@ -46,6 +46,13 @@ stages: targetBuildFramework: $(defaultBuildFramework) unitTest: false codeCoverage: true + - job: Windows_dotnet8 + pool: + name: '$(DefaultWindowsPool)' + steps: + - template: ./jobs/build.yml + parameters: + targetBuildFramework: 'net8.0' - job: Linux_dotnet6 pool: name: '$(DefaultLinuxPool)' @@ -54,8 +61,7 @@ stages: - template: ./jobs/build.yml parameters: targetBuildFramework: 'net6.0' - - + - stage: BuildArtifacts displayName: 'Build artifacts' dependsOn: diff --git a/global.json b/global.json index 120c439854..3b7579aeeb 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "8.0.403" + "version": "9.0.102" } } diff --git a/samples/apps/SmartLauncher/Models/SmartLauncherConfig.cs b/samples/apps/SmartLauncher/Models/SmartLauncherConfig.cs index b8a56aab99..7332d41467 100644 --- a/samples/apps/SmartLauncher/Models/SmartLauncherConfig.cs +++ b/samples/apps/SmartLauncher/Models/SmartLauncherConfig.cs @@ -5,7 +5,7 @@ namespace Microsoft.Health.Internal.SmartLauncher.Models { - public class SmartLauncherConfig + internal class SmartLauncherConfig { #pragma warning disable CA1056 // URI-like properties should not be strings public string FhirServerUrl { get; set; } diff --git a/samples/apps/SmartLauncher/Program.cs b/samples/apps/SmartLauncher/Program.cs index 39d0a72b33..8e8169559f 100644 --- a/samples/apps/SmartLauncher/Program.cs +++ b/samples/apps/SmartLauncher/Program.cs @@ -8,7 +8,7 @@ namespace Microsoft.Health.Internal.SmartLauncher { - public static class Program + internal static class Program { public static void Main(string[] args) { diff --git a/samples/apps/SmartLauncher/Startup.cs b/samples/apps/SmartLauncher/Startup.cs index b8cb2805a0..8e9dc041c2 100644 --- a/samples/apps/SmartLauncher/Startup.cs +++ b/samples/apps/SmartLauncher/Startup.cs @@ -16,6 +16,7 @@ namespace Microsoft.Health.Internal.SmartLauncher { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Maintainability", "CA1515:Consider making public types internal", Justification = "Startup class.")] public class Startup { public Startup(IConfiguration configuration) @@ -27,9 +28,9 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 -#pragma warning disable CA1801 // Review unused parameters + [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Required by runtime.")] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Required by runtime.")] public void ConfigureServices(IServiceCollection services) -#pragma warning restore CA1801 // Review unused parameters { } diff --git a/samples/templates/default-azuredeploy-docker.json b/samples/templates/default-azuredeploy-docker.json index d14ca1c9d1..a7589597de 100644 --- a/samples/templates/default-azuredeploy-docker.json +++ b/samples/templates/default-azuredeploy-docker.json @@ -700,7 +700,7 @@ "apiVersion": "2015-06-01", "properties": { "contentType": "text/plain", - "value": "[concat('Server=tcp:', if(equals(parameters('solutionType'),'FhirServerSqlServer'), reference(variables('computedSqlServerReference'), '2015-05-01-preview').fullyQualifiedDomainName, ''),',1433;Initial Catalog=',variables('sqlDatabaseName'),';Persist Security Info=False;Authentication=ActiveDirectoryMsi;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;User Id=', reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', variables('managedIdentityName')), '2018-11-30').clientId, ';')]" + "value": "[concat('Server=tcp:', if(equals(parameters('solutionType'),'FhirServerSqlServer'), reference(variables('computedSqlServerReference'), '2015-05-01-preview').fullyQualifiedDomainName, ''),',1433;Initial Catalog=',variables('sqlDatabaseName'),';Persist Security Info=False;Authentication=ActiveDirectoryMSI;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;User Id=', reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', variables('managedIdentityName')), '2018-11-30').clientId, ';')]" }, "dependsOn": [ "[resourceId('Microsoft.KeyVault/vaults', variables('serviceName'))]", diff --git a/src/Microsoft.Health.Extensions.Xunit/CustomXunitTestFramework.cs b/src/Microsoft.Health.Extensions.Xunit/CustomXunitTestFramework.cs index 7f1b4695b8..4c60b395a0 100644 --- a/src/Microsoft.Health.Extensions.Xunit/CustomXunitTestFramework.cs +++ b/src/Microsoft.Health.Extensions.Xunit/CustomXunitTestFramework.cs @@ -16,7 +16,7 @@ namespace Microsoft.Health.Extensions.Xunit /// Also allows an assembly to declare one or more , which are created before any tests /// are executed and disposed at the end of the test run. /// - public class CustomXunitTestFramework : XunitTestFramework + public sealed class CustomXunitTestFramework : XunitTestFramework { /// /// This type's assembly name. diff --git a/src/Microsoft.Health.Extensions.Xunit/Microsoft.Health.Extensions.Xunit.csproj b/src/Microsoft.Health.Extensions.Xunit/Microsoft.Health.Extensions.Xunit.csproj index 2d612ebadf..f493041c0b 100644 --- a/src/Microsoft.Health.Extensions.Xunit/Microsoft.Health.Extensions.Xunit.csproj +++ b/src/Microsoft.Health.Extensions.Xunit/Microsoft.Health.Extensions.Xunit.csproj @@ -5,11 +5,11 @@ - $(NoWarn);NU5104;NU5100 + $(NoWarn);NU5104;NU5100;CA1812;CA1515 - $(NoWarn);NU5104;NU5100 + $(NoWarn);NU5104;NU5100;CA1812;CA1515 diff --git a/src/Microsoft.Health.Extensions.Xunit/SingleFlag.cs b/src/Microsoft.Health.Extensions.Xunit/SingleFlag.cs index 1bab678251..b52088ef5f 100644 --- a/src/Microsoft.Health.Extensions.Xunit/SingleFlag.cs +++ b/src/Microsoft.Health.Extensions.Xunit/SingleFlag.cs @@ -11,7 +11,7 @@ namespace Microsoft.Health.Extensions.Xunit /// /// A struct encapsulating an enum value where the numeric value only has a single bit set. /// - public struct SingleFlag : IEquatable + internal struct SingleFlag : IEquatable { public SingleFlag(Enum enumValue) { diff --git a/src/Microsoft.Health.Extensions.Xunit/TestClassWithFixtureArguments.cs b/src/Microsoft.Health.Extensions.Xunit/TestClassWithFixtureArguments.cs index 3eaebb658b..b7c609b0ae 100644 --- a/src/Microsoft.Health.Extensions.Xunit/TestClassWithFixtureArguments.cs +++ b/src/Microsoft.Health.Extensions.Xunit/TestClassWithFixtureArguments.cs @@ -18,7 +18,7 @@ namespace Microsoft.Health.Extensions.Xunit /// A where the class' is a . /// This test class uses a fixture with a single set of constructor arguments. /// - public class TestClassWithFixtureArguments : LongLivedMarshalByRefObject, ITestClass + internal class TestClassWithFixtureArguments : LongLivedMarshalByRefObject, ITestClass { private ITypeInfo _underlyingClass; diff --git a/src/Microsoft.Health.Extensions.Xunit/TestClassWithFixtureArgumentsTypeInfo.cs b/src/Microsoft.Health.Extensions.Xunit/TestClassWithFixtureArgumentsTypeInfo.cs index 99c4583d39..58c5052f3a 100644 --- a/src/Microsoft.Health.Extensions.Xunit/TestClassWithFixtureArgumentsTypeInfo.cs +++ b/src/Microsoft.Health.Extensions.Xunit/TestClassWithFixtureArgumentsTypeInfo.cs @@ -17,7 +17,7 @@ namespace Microsoft.Health.Extensions.Xunit /// A special for a test class that will use a fixture instantiated with with a single set of constructor arguments. /// The property is customized to be of the form Namespace.Class(Arg1, Arg2) /// - public class TestClassWithFixtureArgumentsTypeInfo : LongLivedMarshalByRefObject, IReflectionTypeInfo + internal sealed class TestClassWithFixtureArgumentsTypeInfo : LongLivedMarshalByRefObject, IReflectionTypeInfo { private readonly ITypeInfo _typeInfoImplementation; diff --git a/src/Microsoft.Health.Fhir.Api/Features/BackgroundJobService/JobFactory.cs b/src/Microsoft.Health.Fhir.Api/Features/BackgroundJobService/JobFactory.cs index 456c88bce5..089d08a836 100644 --- a/src/Microsoft.Health.Fhir.Api/Features/BackgroundJobService/JobFactory.cs +++ b/src/Microsoft.Health.Fhir.Api/Features/BackgroundJobService/JobFactory.cs @@ -37,7 +37,7 @@ public JobFactory(IScopeProvider>> jobFactories, ILogger< try { IJob jobInstance = jobFunc.Instance.Invoke(); - if (jobInstance.GetType().GetCustomAttribute(typeof(JobTypeIdAttribute), false) is JobTypeIdAttribute jobTypeAttr) + if (jobInstance.GetType().GetCustomAttribute(false) is JobTypeIdAttribute jobTypeAttr) { _jobFactoryLookup.Add(jobTypeAttr.JobTypeId, jobFunc.Index); } diff --git a/src/Microsoft.Health.Fhir.Api/Registration/FhirServerApplicationBuilderExtensions.cs b/src/Microsoft.Health.Fhir.Api/Registration/FhirServerApplicationBuilderExtensions.cs index 7da6785d2e..eabd16d4a1 100644 --- a/src/Microsoft.Health.Fhir.Api/Registration/FhirServerApplicationBuilderExtensions.cs +++ b/src/Microsoft.Health.Fhir.Api/Registration/FhirServerApplicationBuilderExtensions.cs @@ -75,7 +75,7 @@ public static IApplicationBuilder UseFhirServer( details = healthReport.Entries.Select(entry => new { name = entry.Key, - status = Enum.GetName(typeof(HealthStatus), entry.Value.Status), + status = Enum.GetName(entry.Value.Status), description = entry.Value.Description, data = entry.Value.Data, }), diff --git a/src/Microsoft.Health.Fhir.Core/Features/Definition/CompartmentIndexer.cs b/src/Microsoft.Health.Fhir.Core/Features/Definition/CompartmentIndexer.cs index 0bcc5535e0..e207cbef58 100644 --- a/src/Microsoft.Health.Fhir.Core/Features/Definition/CompartmentIndexer.cs +++ b/src/Microsoft.Health.Fhir.Core/Features/Definition/CompartmentIndexer.cs @@ -32,7 +32,7 @@ public CompartmentIndices Extract(string resourceType, IReadOnlyCollection>(); Dictionary> searchIndicesByCompartmentType = ExtractSearchIndexByCompartmentType(searchIndices); - foreach (CompartmentType compartmentType in Enum.GetValues(typeof(CompartmentType))) + foreach (CompartmentType compartmentType in Enum.GetValues()) { string compartmentTypeLiteral = compartmentType.ToString(); compartmentTypeToResourceIds[compartmentTypeLiteral] = null; diff --git a/src/Microsoft.Health.Fhir.Core/Features/Operations/Export/CreateExportRequestHandler.cs b/src/Microsoft.Health.Fhir.Core/Features/Operations/Export/CreateExportRequestHandler.cs index 3eac4a483d..a9af47ea38 100644 --- a/src/Microsoft.Health.Fhir.Core/Features/Operations/Export/CreateExportRequestHandler.cs +++ b/src/Microsoft.Health.Fhir.Core/Features/Operations/Export/CreateExportRequestHandler.cs @@ -199,7 +199,7 @@ private ExportJobFormatConfiguration ParseFormat(string formatName, bool useCont return formatConfiguration; } - private void ValidateTypeFilters(IList filters) + private void ValidateTypeFilters(List filters) { if (_contextAccessor.GetHandlingHeader() == SearchParameterHandling.Lenient) { diff --git a/src/Microsoft.Health.Fhir.Core/Features/Search/Expressions/Parsers/ExpressionParser.cs b/src/Microsoft.Health.Fhir.Core/Features/Search/Expressions/Parsers/ExpressionParser.cs index 943644ee9f..42cb3094bc 100644 --- a/src/Microsoft.Health.Fhir.Core/Features/Search/Expressions/Parsers/ExpressionParser.cs +++ b/src/Microsoft.Health.Fhir.Core/Features/Search/Expressions/Parsers/ExpressionParser.cs @@ -21,8 +21,8 @@ namespace Microsoft.Health.Fhir.Core.Features.Search.Expressions.Parsers /// public class ExpressionParser : IExpressionParser { - private static readonly Dictionary SearchParamModifierMapping = Enum.GetNames(typeof(SearchModifierCode)) - .Select(e => (SearchModifierCode)Enum.Parse(typeof(SearchModifierCode), e)) + private static readonly Dictionary SearchParamModifierMapping = Enum.GetNames() + .Select(e => Enum.Parse(e)) .ToDictionary( e => e.GetLiteral(), e => e, diff --git a/src/Microsoft.Health.Fhir.Core/Features/Search/Expressions/Parsers/SearchParameterExpressionParser.cs b/src/Microsoft.Health.Fhir.Core/Features/Search/Expressions/Parsers/SearchParameterExpressionParser.cs index 4dda5cec13..338976f546 100644 --- a/src/Microsoft.Health.Fhir.Core/Features/Search/Expressions/Parsers/SearchParameterExpressionParser.cs +++ b/src/Microsoft.Health.Fhir.Core/Features/Search/Expressions/Parsers/SearchParameterExpressionParser.cs @@ -21,7 +21,7 @@ namespace Microsoft.Health.Fhir.Core.Features.Search.Expressions.Parsers /// public class SearchParameterExpressionParser : ISearchParameterExpressionParser { - private static readonly Tuple[] SearchParamComparators = Enum.GetValues(typeof(SearchComparator)) + private static readonly Tuple[] SearchParamComparators = Enum.GetValues() .Cast() .Select(e => Tuple.Create(e.GetLiteral(), e)).ToArray(); diff --git a/src/Microsoft.Health.Fhir.Core/Features/Search/Expressions/Parsers/SearchValueExpressionBuilderHelper.cs b/src/Microsoft.Health.Fhir.Core/Features/Search/Expressions/Parsers/SearchValueExpressionBuilderHelper.cs index fe666ee6cc..401a105214 100644 --- a/src/Microsoft.Health.Fhir.Core/Features/Search/Expressions/Parsers/SearchValueExpressionBuilderHelper.cs +++ b/src/Microsoft.Health.Fhir.Core/Features/Search/Expressions/Parsers/SearchValueExpressionBuilderHelper.cs @@ -35,7 +35,7 @@ public Expression Build( { EnsureArg.IsNotNullOrWhiteSpace(searchParameterName, nameof(searchParameterName)); Debug.Assert( - Enum.IsDefined(typeof(SearchComparator), comparator), + Enum.IsDefined(comparator), "Invalid comparator."); EnsureArg.IsNotNull(searchValue, nameof(searchValue)); diff --git a/src/Microsoft.Health.Fhir.Core/Features/Search/StringExtensions.cs b/src/Microsoft.Health.Fhir.Core/Features/Search/StringExtensions.cs index ea99f2d738..26ab4a7e85 100644 --- a/src/Microsoft.Health.Fhir.Core/Features/Search/StringExtensions.cs +++ b/src/Microsoft.Health.Fhir.Core/Features/Search/StringExtensions.cs @@ -177,7 +177,7 @@ private static List Split(string s, char separator) } } - results.Add(s.Substring(currentSubstringStartingIndex, s.Length - currentSubstringStartingIndex)); + results.Add(s.Substring(currentSubstringStartingIndex)); return results; } diff --git a/src/Microsoft.Health.Fhir.CosmosDb/Features/Storage/FhirCosmosResponseHandler.cs b/src/Microsoft.Health.Fhir.CosmosDb/Features/Storage/FhirCosmosResponseHandler.cs index 8af92bc601..6c7dbc3d5a 100644 --- a/src/Microsoft.Health.Fhir.CosmosDb/Features/Storage/FhirCosmosResponseHandler.cs +++ b/src/Microsoft.Health.Fhir.CosmosDb/Features/Storage/FhirCosmosResponseHandler.cs @@ -24,7 +24,7 @@ public class FhirCosmosResponseHandler : RequestHandler private const string _consistencyLevelHeaderName = "x-ms-consistency-level"; private const string _sessionTokenHeaderName = "x-ms-session-token"; - private static readonly string _validConsistencyLevelsForErrorMessage = string.Join(", ", Enum.GetNames(typeof(ConsistencyLevel)).Select(v => $"'{v}'")); + private static readonly string _validConsistencyLevelsForErrorMessage = string.Join(", ", Enum.GetNames().Select(v => $"'{v}'")); private readonly Func> _client; private readonly CosmosDataStoreConfiguration _cosmosDataStoreConfiguration; private readonly RequestContextAccessor _fhirRequestContextAccessor; diff --git a/src/Microsoft.Health.Fhir.R4.Web/Properties/AssemblyInfo.cs b/src/Microsoft.Health.Fhir.R4.Web/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..ec5805d8e6 --- /dev/null +++ b/src/Microsoft.Health.Fhir.R4.Web/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// ------------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. +// ------------------------------------------------------------------------------------------------- + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] +[assembly: InternalsVisibleTo("Microsoft.Health.Fhir.R4.Web.UnitTests")] diff --git a/src/Microsoft.Health.Fhir.R4B.Web/Properties/AssemblyInfo.cs b/src/Microsoft.Health.Fhir.R4B.Web/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..d29851cf41 --- /dev/null +++ b/src/Microsoft.Health.Fhir.R4B.Web/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// ------------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. +// ------------------------------------------------------------------------------------------------- + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] +[assembly: InternalsVisibleTo("Microsoft.Health.Fhir.R4B.Web.UnitTests")] diff --git a/src/Microsoft.Health.Fhir.R5.Web/Properties/AssemblyInfo.cs b/src/Microsoft.Health.Fhir.R5.Web/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..db49ea46b4 --- /dev/null +++ b/src/Microsoft.Health.Fhir.R5.Web/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// ------------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. +// ------------------------------------------------------------------------------------------------- + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] +[assembly: InternalsVisibleTo("Microsoft.Health.Fhir.R5.Web.UnitTests")] diff --git a/src/Microsoft.Health.Fhir.Shared.Api/Features/Resources/Bundle/BundleHandler.cs b/src/Microsoft.Health.Fhir.Shared.Api/Features/Resources/Bundle/BundleHandler.cs index 70ea90ccf3..243de5dc3a 100644 --- a/src/Microsoft.Health.Fhir.Shared.Api/Features/Resources/Bundle/BundleHandler.cs +++ b/src/Microsoft.Health.Fhir.Shared.Api/Features/Resources/Bundle/BundleHandler.cs @@ -501,7 +501,7 @@ private async Task FillRequestLists(List bundleEntries, Cancella private async Task GenerateRequest(EntryComponent entry, int order, CancellationToken cancellationToken) { string persistedId = default; - HttpContext httpContext = new DefaultHttpContext { RequestServices = _requestServices }; + DefaultHttpContext httpContext = new DefaultHttpContext { RequestServices = _requestServices }; var requestUrl = entry.Request?.Url; @@ -597,7 +597,7 @@ private async Task GenerateRequest(EntryComponent entry, int order, Cancellation _requests[requestMethod].Add(new ResourceExecutionContext(requestMethod, entry.Resource?.TypeName, routeContext, order, persistedId)); } - private static void AddHeaderIfNeeded(string headerKey, string headerValue, HttpContext httpContext) + private static void AddHeaderIfNeeded(string headerKey, string headerValue, DefaultHttpContext httpContext) { if (!string.IsNullOrWhiteSpace(headerValue)) { diff --git a/src/Microsoft.Health.Fhir.Shared.Api/Modules/MvcModule.cs b/src/Microsoft.Health.Fhir.Shared.Api/Modules/MvcModule.cs index 390a23571d..b3c9bdf9e7 100644 --- a/src/Microsoft.Health.Fhir.Shared.Api/Modules/MvcModule.cs +++ b/src/Microsoft.Health.Fhir.Shared.Api/Modules/MvcModule.cs @@ -38,7 +38,7 @@ public void Load(IServiceCollection services) options.ModelBinderProviders.Insert(0, new PartialDateTimeBinderProvider()); // This filter should run first because it populates data for FhirRequestContext. - options.Filters.Add(typeof(FhirRequestContextRouteDataPopulatingFilterAttribute), 0); + options.Filters.Add(0); }); services.AddHttpContextAccessor(); diff --git a/src/Microsoft.Health.Fhir.Shared.Api/Modules/SearchModule.cs b/src/Microsoft.Health.Fhir.Shared.Api/Modules/SearchModule.cs index 760ddb44d4..706f9d6ef3 100644 --- a/src/Microsoft.Health.Fhir.Shared.Api/Modules/SearchModule.cs +++ b/src/Microsoft.Health.Fhir.Shared.Api/Modules/SearchModule.cs @@ -153,9 +153,9 @@ public void Load(IServiceCollection services) services.AddTransient(); services.AddTransient(); - services.AddTransient(typeof(IPipelineBehavior), typeof(CreateOrUpdateSearchParameterBehavior)); - services.AddTransient(typeof(IPipelineBehavior), typeof(CreateOrUpdateSearchParameterBehavior)); - services.AddTransient(typeof(IPipelineBehavior), typeof(DeleteSearchParameterBehavior)); + services.AddTransient, CreateOrUpdateSearchParameterBehavior>(); + services.AddTransient, CreateOrUpdateSearchParameterBehavior>(); + services.AddTransient, DeleteSearchParameterBehavior>(); } } } diff --git a/src/Microsoft.Health.Fhir.Shared.Core/Features/Operations/SearchParameterState/SearchParameterStateHandler.cs b/src/Microsoft.Health.Fhir.Shared.Core/Features/Operations/SearchParameterState/SearchParameterStateHandler.cs index 05210b887b..7b334b47f2 100644 --- a/src/Microsoft.Health.Fhir.Shared.Core/Features/Operations/SearchParameterState/SearchParameterStateHandler.cs +++ b/src/Microsoft.Health.Fhir.Shared.Core/Features/Operations/SearchParameterState/SearchParameterStateHandler.cs @@ -83,7 +83,7 @@ public async Task Handle(SearchParameterStateReque return await GetSearchParameterStateAsync(searchParameterResult.ToList(), cancellationToken); } - private async Task GetSearchParameterStateAsync(ICollection searchParameterResult, CancellationToken cancellationToken = default) + private async Task GetSearchParameterStateAsync(List searchParameterResult, CancellationToken cancellationToken = default) { if (searchParameterResult.Count == 0) { diff --git a/src/Microsoft.Health.Fhir.Shared.Core/Features/Resources/Patch/FhirPathPatch/Operations/PendingOperation.cs b/src/Microsoft.Health.Fhir.Shared.Core/Features/Resources/Patch/FhirPathPatch/Operations/PendingOperation.cs index 3956c924ee..cdee3b59f0 100644 --- a/src/Microsoft.Health.Fhir.Shared.Core/Features/Resources/Patch/FhirPathPatch/Operations/PendingOperation.cs +++ b/src/Microsoft.Health.Fhir.Shared.Core/Features/Resources/Patch/FhirPathPatch/Operations/PendingOperation.cs @@ -67,9 +67,7 @@ internal static PendingOperation FromParameterComponent(ParameterComponent compo PatchOperationType operationType; try { - operationType = (PatchOperationType)Enum.Parse( - typeof(PatchOperationType), - operationTypeString.ToUpper(new CultureInfo("en-US", false))); + operationType = Enum.Parse(operationTypeString.ToUpper(new CultureInfo("en-US", false))); } catch (ArgumentException) { diff --git a/src/Microsoft.Health.Fhir.Shared.Core/Features/Search/Parameters/SearchParameterTypeResult.cs b/src/Microsoft.Health.Fhir.Shared.Core/Features/Search/Parameters/SearchParameterTypeResult.cs index 141d69752c..41f917719e 100644 --- a/src/Microsoft.Health.Fhir.Shared.Core/Features/Search/Parameters/SearchParameterTypeResult.cs +++ b/src/Microsoft.Health.Fhir.Shared.Core/Features/Search/Parameters/SearchParameterTypeResult.cs @@ -19,7 +19,7 @@ public SearchParameterTypeResult(ClassMapping classMapping, SearchParamType sear Path = path; Definition = definition; - FhirNodeType = ((FhirTypeAttribute)ClassMapping.NativeType.GetCustomAttribute(typeof(FhirTypeAttribute))).Name; + FhirNodeType = ClassMapping.NativeType.GetCustomAttribute().Name; } public ClassMapping ClassMapping { get; set; } diff --git a/src/Microsoft.Health.Fhir.Shared.Core/Operations/Export/ExportAnonymizerFactory.cs b/src/Microsoft.Health.Fhir.Shared.Core/Operations/Export/ExportAnonymizerFactory.cs index e426fe13c1..b77650bc17 100644 --- a/src/Microsoft.Health.Fhir.Shared.Core/Operations/Export/ExportAnonymizerFactory.cs +++ b/src/Microsoft.Health.Fhir.Shared.Core/Operations/Export/ExportAnonymizerFactory.cs @@ -32,7 +32,7 @@ public async Task CreateAnonymizerAsync(ExportJobRecord exportJobRe { EnsureArg.IsNotNullOrEmpty(exportJobRecord.AnonymizationConfigurationLocation, nameof(exportJobRecord.AnonymizationConfigurationLocation)); - using (Stream stream = new MemoryStream()) + using (var stream = new MemoryStream()) { try { diff --git a/src/Microsoft.Health.Fhir.Shared.Core/VersionSpecificModelInfoProvider.cs b/src/Microsoft.Health.Fhir.Shared.Core/VersionSpecificModelInfoProvider.cs index 11e5eeb8c9..db0dec5e06 100644 --- a/src/Microsoft.Health.Fhir.Shared.Core/VersionSpecificModelInfoProvider.cs +++ b/src/Microsoft.Health.Fhir.Shared.Core/VersionSpecificModelInfoProvider.cs @@ -59,7 +59,7 @@ public IReadOnlyCollection GetResourceTypeNames() public IReadOnlyCollection GetCompartmentTypeNames() { - return Enum.GetNames(typeof(CompartmentType)); + return Enum.GetNames(); } public Type GetTypeForFhirType(string resourceType) diff --git a/src/Microsoft.Health.Fhir.Shared.Web/AzureMonitorOpenTelemetryLogEnricher.cs b/src/Microsoft.Health.Fhir.Shared.Web/AzureMonitorOpenTelemetryLogEnricher.cs index e87aaa5363..d3f0744d9e 100644 --- a/src/Microsoft.Health.Fhir.Shared.Web/AzureMonitorOpenTelemetryLogEnricher.cs +++ b/src/Microsoft.Health.Fhir.Shared.Web/AzureMonitorOpenTelemetryLogEnricher.cs @@ -18,7 +18,8 @@ namespace Microsoft.Health.Fhir.Shared.Web { - public class AzureMonitorOpenTelemetryLogEnricher : BaseProcessor + [System.Diagnostics.CodeAnalysis.SuppressMessage("Maintainability", "CA1515:Consider making public types internal", Justification = "Referenced by other assembles via shared projects.")] + public sealed class AzureMonitorOpenTelemetryLogEnricher : BaseProcessor { private readonly IHttpContextAccessor _httpContextAccessor; private readonly IFailureMetricHandler _failureMetricHandler; diff --git a/src/Microsoft.Health.Fhir.Shared.Web/CloudRoleNameTelemetryInitializer.cs b/src/Microsoft.Health.Fhir.Shared.Web/CloudRoleNameTelemetryInitializer.cs index b0234fac94..fac3f7f545 100644 --- a/src/Microsoft.Health.Fhir.Shared.Web/CloudRoleNameTelemetryInitializer.cs +++ b/src/Microsoft.Health.Fhir.Shared.Web/CloudRoleNameTelemetryInitializer.cs @@ -8,7 +8,7 @@ namespace Microsoft.Health.Fhir.Web { - public class CloudRoleNameTelemetryInitializer : ITelemetryInitializer + internal sealed class CloudRoleNameTelemetryInitializer : ITelemetryInitializer { public void Initialize(ITelemetry telemetry) { diff --git a/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderApplicationConfiguration.cs b/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderApplicationConfiguration.cs index a6d4bf9b00..d79d436759 100644 --- a/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderApplicationConfiguration.cs +++ b/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderApplicationConfiguration.cs @@ -7,7 +7,8 @@ namespace Microsoft.Health.Fhir.Web { - public class DevelopmentIdentityProviderApplicationConfiguration + [System.Diagnostics.CodeAnalysis.SuppressMessage("Maintainability", "CA1515:Consider making public types internal", Justification = "Referenced by other assembles via shared projects.")] + public sealed class DevelopmentIdentityProviderApplicationConfiguration { public string Id { get; set; } diff --git a/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderConfiguration.cs b/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderConfiguration.cs index 37c315a771..2863c65178 100644 --- a/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderConfiguration.cs +++ b/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderConfiguration.cs @@ -7,7 +7,8 @@ namespace Microsoft.Health.Fhir.Web { - public class DevelopmentIdentityProviderConfiguration + [System.Diagnostics.CodeAnalysis.SuppressMessage("Maintainability", "CA1515:Consider making public types internal", Justification = "Referenced by other assembles via shared projects.")] + public sealed class DevelopmentIdentityProviderConfiguration { public const string Audience = "fhir-api"; public const string LastModifiedClaim = "appid"; diff --git a/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderRegistrationExtensions.cs b/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderRegistrationExtensions.cs index a242a85177..74c53cd351 100644 --- a/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderRegistrationExtensions.cs +++ b/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderRegistrationExtensions.cs @@ -24,6 +24,7 @@ namespace Microsoft.Health.Fhir.Web { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Maintainability", "CA1515:Consider making public types internal", Justification = "Contains extension methods.")] public static class DevelopmentIdentityProviderRegistrationExtensions { private const string WrongAudienceClient = "wrongAudienceClient"; diff --git a/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderUserConfiguration.cs b/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderUserConfiguration.cs index 3b4f9099b2..8cbc8d95d3 100644 --- a/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderUserConfiguration.cs +++ b/src/Microsoft.Health.Fhir.Shared.Web/DevelopmentIdentityProviderUserConfiguration.cs @@ -7,7 +7,8 @@ namespace Microsoft.Health.Fhir.Web { - public class DevelopmentIdentityProviderUserConfiguration + [System.Diagnostics.CodeAnalysis.SuppressMessage("Maintainability", "CA1515:Consider making public types internal", Justification = "Referenced by other assembles via shared projects.")] + public sealed class DevelopmentIdentityProviderUserConfiguration { public string Id { get; set; } diff --git a/src/Microsoft.Health.Fhir.Shared.Web/Program.cs b/src/Microsoft.Health.Fhir.Shared.Web/Program.cs index 6340a41ea2..948cdb8f98 100644 --- a/src/Microsoft.Health.Fhir.Shared.Web/Program.cs +++ b/src/Microsoft.Health.Fhir.Shared.Web/Program.cs @@ -13,7 +13,7 @@ namespace Microsoft.Health.Fhir.Web { - public static class Program + internal static class Program { public static void Main(string[] args) { diff --git a/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsApplicationBuilderExtensions.cs b/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsApplicationBuilderExtensions.cs index ec9c8fc782..9cdaccd9bc 100644 --- a/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsApplicationBuilderExtensions.cs +++ b/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsApplicationBuilderExtensions.cs @@ -10,6 +10,7 @@ namespace Microsoft.AspNetCore.Builder { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Maintainability", "CA1515:Consider making public types internal", Justification = "Contains extension methods.")] public static class PrometheusMetricsApplicationBuilderExtensions { public static IApplicationBuilder UsePrometheusHttpMetrics(this IApplicationBuilder app) diff --git a/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsConfig.cs b/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsConfig.cs index 5b9d44844a..5bb3a959c2 100644 --- a/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsConfig.cs +++ b/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsConfig.cs @@ -5,7 +5,7 @@ namespace Microsoft.Health.Fhir.Web { - public class PrometheusMetricsConfig + internal sealed class PrometheusMetricsConfig { public bool Enabled { get; set; } = false; diff --git a/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsServer.cs b/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsServer.cs index 4b0d973157..41cd484dd4 100644 --- a/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsServer.cs +++ b/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsServer.cs @@ -14,7 +14,7 @@ namespace Microsoft.Health.Fhir.Web { - public sealed class PrometheusMetricsServer : IHostedService, IDisposable + internal sealed class PrometheusMetricsServer : IHostedService, IDisposable { private readonly PrometheusMetricsConfig _prometheusMetricsConfig; private readonly ILogger _logger; diff --git a/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsServicesCollectionExtensions.cs b/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsServicesCollectionExtensions.cs index bed6504483..0ec09b3c1a 100644 --- a/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsServicesCollectionExtensions.cs +++ b/src/Microsoft.Health.Fhir.Shared.Web/PrometheusMetricsServicesCollectionExtensions.cs @@ -12,7 +12,7 @@ namespace Microsoft.Health.Fhir.Web { - public static class PrometheusMetricsServicesCollectionExtensions + internal static class PrometheusMetricsServicesCollectionExtensions { public static void AddPrometheusMetrics( this IServiceCollection services, diff --git a/src/Microsoft.Health.Fhir.Shared.Web/Startup.cs b/src/Microsoft.Health.Fhir.Shared.Web/Startup.cs index 6d746be084..671d61aa11 100644 --- a/src/Microsoft.Health.Fhir.Shared.Web/Startup.cs +++ b/src/Microsoft.Health.Fhir.Shared.Web/Startup.cs @@ -42,6 +42,7 @@ namespace Microsoft.Health.Fhir.Web { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Maintainability", "CA1515:Consider making public types internal", Justification = "Internal framework instantiation.")] public class Startup { private static string instanceId; diff --git a/src/Microsoft.Health.Fhir.Shared.Web/UserAgentHeaderTelemetryInitializer.cs b/src/Microsoft.Health.Fhir.Shared.Web/UserAgentHeaderTelemetryInitializer.cs index a891a5b4fe..9b6f28eda8 100644 --- a/src/Microsoft.Health.Fhir.Shared.Web/UserAgentHeaderTelemetryInitializer.cs +++ b/src/Microsoft.Health.Fhir.Shared.Web/UserAgentHeaderTelemetryInitializer.cs @@ -12,7 +12,7 @@ namespace Microsoft.Health.Fhir.Shared.Web { - public class UserAgentHeaderTelemetryInitializer : ITelemetryInitializer + internal sealed class UserAgentHeaderTelemetryInitializer : ITelemetryInitializer { private readonly IHttpContextAccessor _httpContextAccessor; diff --git a/src/Microsoft.Health.Fhir.SqlServer/Features/Search/Expressions/Visitors/IncludeRewriter.cs b/src/Microsoft.Health.Fhir.SqlServer/Features/Search/Expressions/Visitors/IncludeRewriter.cs index e4469f52f3..5734de21eb 100644 --- a/src/Microsoft.Health.Fhir.SqlServer/Features/Search/Expressions/Visitors/IncludeRewriter.cs +++ b/src/Microsoft.Health.Fhir.SqlServer/Features/Search/Expressions/Visitors/IncludeRewriter.cs @@ -63,7 +63,7 @@ public override Expression VisitSqlRoot(SqlRootExpression expression, object con return new SqlRootExpression(reorderedExpressions, expression.ResourceTableExpressions); } - private static IList SortIncludeIterateExpressions(IList expressions) + private static List SortIncludeIterateExpressions(List expressions) { // Based on Khan's algorithm. See https://en.wikipedia.org/wiki/Topological_sorting. // The search queries are acyclic. diff --git a/src/Microsoft.Health.Fhir.Stu3.Web/Properties/AssemblyInfo.cs b/src/Microsoft.Health.Fhir.Stu3.Web/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..a9eec93e92 --- /dev/null +++ b/src/Microsoft.Health.Fhir.Stu3.Web/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// ------------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. +// ------------------------------------------------------------------------------------------------- + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] +[assembly: InternalsVisibleTo("Microsoft.Health.Fhir.Stu3.Web.UnitTests")] diff --git a/src/Microsoft.Health.TaskManagement/JobInfoExtensions.cs b/src/Microsoft.Health.TaskManagement/JobInfoExtensions.cs index 7aadb947c3..996278691e 100644 --- a/src/Microsoft.Health.TaskManagement/JobInfoExtensions.cs +++ b/src/Microsoft.Health.TaskManagement/JobInfoExtensions.cs @@ -18,7 +18,7 @@ public static class JobInfoExtensions try { - IJobData jobDataDefinition = JsonConvert.DeserializeObject(jobInfo.Definition); + JobDataDefinition jobDataDefinition = JsonConvert.DeserializeObject(jobInfo.Definition); return jobDataDefinition?.TypeId; } diff --git a/test/Microsoft.Health.Fhir.Shared.Tests.Integration/Persistence/SqlAzurePipelinesWorkloadIdentityAuthenticationProvider.cs b/test/Microsoft.Health.Fhir.Shared.Tests.Integration/Persistence/SqlAzurePipelinesWorkloadIdentityAuthenticationProvider.cs index b4b1dda7ff..74899a741b 100644 --- a/test/Microsoft.Health.Fhir.Shared.Tests.Integration/Persistence/SqlAzurePipelinesWorkloadIdentityAuthenticationProvider.cs +++ b/test/Microsoft.Health.Fhir.Shared.Tests.Integration/Persistence/SqlAzurePipelinesWorkloadIdentityAuthenticationProvider.cs @@ -10,7 +10,6 @@ using Azure.Identity; using Microsoft.Data.SqlClient; using Microsoft.Identity.Client; -using Microsoft.SqlServer.Dac; namespace Microsoft.Health.Fhir.Tests.Integration.Persistence; diff --git a/tools/BlobRewriter/Program.cs b/tools/BlobRewriter/Program.cs index 6c3d49d016..6e0945f3bf 100644 --- a/tools/BlobRewriter/Program.cs +++ b/tools/BlobRewriter/Program.cs @@ -24,7 +24,7 @@ namespace Microsoft.Health.Internal.Fhir.BlobRewriter { - public static class Program + internal static class Program { private static readonly string SourceConnectionString = ConfigurationManager.AppSettings["SourceConnectionString"]; private static readonly string TargetConnectionString = ConfigurationManager.AppSettings["TargetConnectionString"]; diff --git a/tools/EventsReader/Program.cs b/tools/EventsReader/Program.cs index 32cd8a3dd2..17d63225c9 100644 --- a/tools/EventsReader/Program.cs +++ b/tools/EventsReader/Program.cs @@ -12,7 +12,7 @@ namespace Microsoft.Health.Internal.Fhir.EventsReader { - public static class Program + internal static class Program { private static readonly string _connectionString = ConfigurationManager.ConnectionStrings["Database"].ConnectionString; private static SqlRetryService _sqlRetryService; diff --git a/tools/EventsReader/SqlConnectionBuilder.cs b/tools/EventsReader/SqlConnectionBuilder.cs index 8d5cbebff7..a1ab759f80 100644 --- a/tools/EventsReader/SqlConnectionBuilder.cs +++ b/tools/EventsReader/SqlConnectionBuilder.cs @@ -8,7 +8,7 @@ namespace Microsoft.Health.Internal.Fhir.Sql { - public class SqlConnectionBuilder : ISqlConnectionBuilder + internal class SqlConnectionBuilder : ISqlConnectionBuilder { private readonly string _connectionString; diff --git a/tools/Exporter/Exporter.csproj b/tools/Exporter/Exporter.csproj index 99a406015a..35da8f124f 100644 --- a/tools/Exporter/Exporter.csproj +++ b/tools/Exporter/Exporter.csproj @@ -15,7 +15,7 @@ - + diff --git a/tools/Exporter/Program.cs b/tools/Exporter/Program.cs index 58f8f02c66..acd0aaa0b6 100644 --- a/tools/Exporter/Program.cs +++ b/tools/Exporter/Program.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Generic; using System.Configuration; -using System.Data.SqlClient; using System.Diagnostics; using System.IO; using System.Linq; @@ -14,6 +13,8 @@ using System.Threading.Tasks; using Azure.Storage.Blobs; using Azure.Storage.Blobs.Specialized; +using Microsoft.Data.SqlClient; +using Microsoft.Data.SqlClient.Server; using Microsoft.Health.Fhir.SqlServer.Features; using Microsoft.Health.Fhir.Store.Export; using Microsoft.Health.Fhir.Store.Utils; @@ -21,7 +22,7 @@ namespace Microsoft.Health.Internal.Fhir.Exporter { - public static class Program + internal static class Program { private static readonly string _connectionString = ConfigurationManager.ConnectionStrings["Database"].ConnectionString; private static readonly SqlService Store = new SqlService(_connectionString); diff --git a/tools/Exporter/SqlParamaterStringExtension.cs b/tools/Exporter/SqlParamaterStringExtension.cs index 4db3e241f6..6e0d7e1cdc 100644 --- a/tools/Exporter/SqlParamaterStringExtension.cs +++ b/tools/Exporter/SqlParamaterStringExtension.cs @@ -5,12 +5,13 @@ using System.Collections.Generic; using System.Data; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; +using Microsoft.Data.SqlClient.Server; using Microsoft.SqlServer.Server; namespace Microsoft.Health.Fhir.Store.Export { - public static class SqlParamaterStringExtension + internal static class SqlParamaterStringExtension { static SqlParamaterStringExtension() { diff --git a/tools/Exporter/SqlService.cs b/tools/Exporter/SqlService.cs index c829a783fa..547dfb3b62 100644 --- a/tools/Exporter/SqlService.cs +++ b/tools/Exporter/SqlService.cs @@ -4,9 +4,10 @@ // ------------------------------------------------------------------------------------------------- using System.Collections.Generic; using System.Data; -using System.Data.SqlClient; using System.IO; using System.Threading; +using Microsoft.Data.SqlClient; +using Microsoft.Data.SqlClient.Server; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Health.Fhir.Core.Features.Operations; using Microsoft.Health.Fhir.SqlServer.Features.Storage; diff --git a/tools/Importer/BearerTokenHandler.cs b/tools/Importer/BearerTokenHandler.cs index b1d4cb4a9d..e2700e072e 100644 --- a/tools/Importer/BearerTokenHandler.cs +++ b/tools/Importer/BearerTokenHandler.cs @@ -18,7 +18,7 @@ namespace Microsoft.Health.Fhir.Importer; -public class BearerTokenHandler : DelegatingHandler +internal class BearerTokenHandler : DelegatingHandler { private readonly Dictionary _accessTokenCaches = []; diff --git a/tools/Importer/Program.cs b/tools/Importer/Program.cs index 0a022ddf45..3e6e296340 100644 --- a/tools/Importer/Program.cs +++ b/tools/Importer/Program.cs @@ -5,7 +5,7 @@ namespace Microsoft.Health.Fhir.Importer { - public static class Program + internal static class Program { public static void Main() { diff --git a/tools/IndexRebuilder/IndexRebuilder.cs b/tools/IndexRebuilder/IndexRebuilder.cs index 4cc68f7a6b..7244fadf54 100644 --- a/tools/IndexRebuilder/IndexRebuilder.cs +++ b/tools/IndexRebuilder/IndexRebuilder.cs @@ -6,8 +6,9 @@ using System; using System.Collections.Generic; using System.Data; -using System.Data.SqlClient; using System.Linq; +using Microsoft.Data.SqlClient; +using Microsoft.Data.SqlClient.Server; using Microsoft.Health.Fhir.Store.Utils; namespace Microsoft.Health.Internal.IndexRebuilder diff --git a/tools/IndexRebuilder/IndexRebuilder.csproj b/tools/IndexRebuilder/IndexRebuilder.csproj index 049c51ab74..77a0c7817c 100644 --- a/tools/IndexRebuilder/IndexRebuilder.csproj +++ b/tools/IndexRebuilder/IndexRebuilder.csproj @@ -8,7 +8,7 @@ - + diff --git a/tools/IndexRebuilder/Program.cs b/tools/IndexRebuilder/Program.cs index f15ab1b50d..fc95b3afc5 100644 --- a/tools/IndexRebuilder/Program.cs +++ b/tools/IndexRebuilder/Program.cs @@ -5,12 +5,13 @@ using System; using System.Configuration; -using System.Data.SqlClient; using System.Diagnostics; +using Microsoft.Data.SqlClient; +using Microsoft.Data.SqlClient.Server; namespace Microsoft.Health.Internal.IndexRebuilder { - public static class Program + internal static class Program { private static readonly string ConnectionString = ConfigurationManager.ConnectionStrings["Database"].ConnectionString; private static readonly int Threads = int.Parse(ConfigurationManager.AppSettings["Threads"]); diff --git a/tools/RegisterAndMonitorImport/ImportResponse.cs b/tools/RegisterAndMonitorImport/ImportResponse.cs index 7037661ec3..1f26b1bdc0 100644 --- a/tools/RegisterAndMonitorImport/ImportResponse.cs +++ b/tools/RegisterAndMonitorImport/ImportResponse.cs @@ -17,7 +17,7 @@ internal sealed class ImportResponse [JsonPropertyName("output")] public List Output { get; set; } = new(); - public sealed class Json + internal sealed class Json { [JsonPropertyName("type")] public string Type { get; set; } = string.Empty; diff --git a/tools/RegisterAndMonitorImport/Program.cs b/tools/RegisterAndMonitorImport/Program.cs index 99a15cbd16..875ff1bbd0 100644 --- a/tools/RegisterAndMonitorImport/Program.cs +++ b/tools/RegisterAndMonitorImport/Program.cs @@ -9,7 +9,7 @@ namespace Microsoft.Health.Internal.Fhir.RegisterAndMonitorImport { - public static class Program + internal static class Program { public static async Task Main() { diff --git a/tools/RegisterAndMonitorImport/VerbosityLevel.cs b/tools/RegisterAndMonitorImport/VerbosityLevel.cs index a187a64d75..dd2ee28ee4 100644 --- a/tools/RegisterAndMonitorImport/VerbosityLevel.cs +++ b/tools/RegisterAndMonitorImport/VerbosityLevel.cs @@ -5,7 +5,7 @@ namespace Microsoft.Health.Internal.Fhir.RegisterAndMonitorImport { - public enum VerbosityLevel + internal enum VerbosityLevel { Full = 5, FullOnComplete = 4, diff --git a/tools/ResourceParser/Program.cs b/tools/ResourceParser/Program.cs index 84de2caf47..d11e0e60af 100644 --- a/tools/ResourceParser/Program.cs +++ b/tools/ResourceParser/Program.cs @@ -5,7 +5,7 @@ namespace ResourceParser { - public static class Program + internal static class Program { public static void Main(string[] args) { diff --git a/tools/SqlScriptRunner/Program.cs b/tools/SqlScriptRunner/Program.cs index 9ace9eeb5d..27f1f34b48 100644 --- a/tools/SqlScriptRunner/Program.cs +++ b/tools/SqlScriptRunner/Program.cs @@ -14,7 +14,7 @@ namespace Microsoft.Health.Internal.Fhir.SqlScriptRunner { - public static class Program + internal static class Program { private static readonly string _connectionString = ConfigurationManager.ConnectionStrings["Database"].ConnectionString; private static readonly string _script = ConfigurationManager.AppSettings["Script"];