diff --git a/.editorconfig b/.editorconfig index f25bbdc43..a87fd69d8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -27,7 +27,7 @@ tab_width = 2 # Solution and project configuration files -[*.{props,targets,yml,ruleset,nuspec,vsixmanifest,vsct}] +[*.{props,targets,manifest,yml,ruleset,nuspec,vsixmanifest,vsct}] indent_size = 2 tab_width = 2 @@ -76,56 +76,57 @@ dotnet_sort_system_directives_first = true file_header_template = unset # this. and Me. preferences -dotnet_style_qualification_for_event = false -dotnet_style_qualification_for_field = false -dotnet_style_qualification_for_method = false -dotnet_style_qualification_for_property = false +dotnet_style_qualification_for_event = false:silent +dotnet_style_qualification_for_field = false:silent +dotnet_style_qualification_for_method = false:silent +dotnet_style_qualification_for_property = false:silent # Language keywords vs BCL types preferences -dotnet_style_predefined_type_for_locals_parameters_members = true -dotnet_style_predefined_type_for_member_access = true +dotnet_style_predefined_type_for_locals_parameters_members = true:silent +dotnet_style_predefined_type_for_member_access = true:silent # Parentheses preferences -dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity -dotnet_style_parentheses_in_other_binary_operators = always_for_clarity -dotnet_style_parentheses_in_other_operators = never_if_unnecessary -dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent # Modifier preferences -dotnet_style_require_accessibility_modifiers = for_non_interface_members +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent # Expression-level preferences -dotnet_style_coalesce_expression = true -dotnet_style_collection_initializer = true -dotnet_style_explicit_tuple_names = true -dotnet_style_namespace_match_folder = true +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_namespace_match_folder = true:suggestion dotnet_diagnostic.IDE0130.severity = suggestion -dotnet_style_null_propagation = true -dotnet_style_object_initializer = true +dotnet_style_null_propagation = true:suggestion +dotnet_style_object_initializer = true:suggestion dotnet_style_operator_placement_when_wrapping = end_of_line -dotnet_style_prefer_auto_properties = true -dotnet_style_prefer_compound_assignment = true -dotnet_style_prefer_conditional_expression_over_assignment = true -dotnet_style_prefer_conditional_expression_over_return = true +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_prefer_collection_expression = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed -dotnet_style_prefer_inferred_anonymous_type_member_names = true -dotnet_style_prefer_inferred_tuple_names = true -dotnet_style_prefer_is_null_check_over_reference_equality_method = true -dotnet_style_prefer_simplified_boolean_expressions = true -dotnet_style_prefer_simplified_interpolation = true +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion # Field preferences -dotnet_style_readonly_field = true +dotnet_style_readonly_field = true:suggestion # Parameter preferences -dotnet_code_quality_unused_parameters = all +dotnet_code_quality_unused_parameters = all:suggestion # Suppression preferences dotnet_remove_unnecessary_suppression_exclusions = none # New line preferences -dotnet_style_allow_multiple_blank_lines_experimental = true -dotnet_style_allow_statement_immediately_after_block_experimental = false +dotnet_style_allow_multiple_blank_lines_experimental = true:silent +dotnet_style_allow_statement_immediately_after_block_experimental = false:silent #### Naming styles #### @@ -177,11 +178,19 @@ dotnet_naming_style.begins_with_i.capitalization = pascal_case # CA1307: Specify StringComparison for clarity # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1307 -dotnet_diagnostic.CA1307.severity = suggestion +dotnet_diagnostic.CA1307.severity = warning # CA1309: Use ordinal StringComparison # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1309 -dotnet_diagnostic.CA1309.severity = suggestion +dotnet_diagnostic.CA1309.severity = warning + +# CA1311: Specify a culture or use an invariant version +# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1311 +dotnet_diagnostic.CA1311.severity = warning + +# CA1815: Override equals and operator equals on value types +# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1815 +dotnet_diagnostic.CA1815.severity = error # C# files @@ -190,64 +199,64 @@ dotnet_diagnostic.CA1309.severity = suggestion #### C# Coding Conventions #### # var preferences -csharp_style_var_elsewhere = true -csharp_style_var_for_built_in_types = true -csharp_style_var_when_type_is_apparent = true +csharp_style_var_elsewhere = true:silent +csharp_style_var_for_built_in_types = true:silent +csharp_style_var_when_type_is_apparent = true:silent # Expression-bodied members -csharp_style_expression_bodied_accessors = true -csharp_style_expression_bodied_constructors = false -csharp_style_expression_bodied_indexers = true -csharp_style_expression_bodied_lambdas = true -csharp_style_expression_bodied_local_functions = false -csharp_style_expression_bodied_methods = false -csharp_style_expression_bodied_operators = false -csharp_style_expression_bodied_properties = true +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_local_functions = false:silent +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent # Pattern matching preferences -csharp_style_pattern_matching_over_as_with_null_check = true -csharp_style_pattern_matching_over_is_with_cast_check = true -csharp_style_prefer_extended_property_pattern = true -csharp_style_prefer_not_pattern = true -csharp_style_prefer_pattern_matching = true -csharp_style_prefer_switch_expression = true +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_prefer_extended_property_pattern = true:suggestion +csharp_style_prefer_not_pattern = true:suggestion +csharp_style_prefer_pattern_matching = true:silent +csharp_style_prefer_switch_expression = true:suggestion # Null-checking preferences -csharp_style_conditional_delegate_call = true +csharp_style_conditional_delegate_call = true:suggestion # Modifier preferences -csharp_prefer_static_local_function = true +csharp_prefer_static_local_function = true:suggestion csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async # Code-block preferences -csharp_prefer_braces = true -csharp_prefer_simple_using_statement = true -csharp_style_namespace_declarations = block_scoped -csharp_style_prefer_method_group_conversion = true -csharp_style_prefer_top_level_statements = true +csharp_prefer_braces = true:silent +csharp_prefer_simple_using_statement = true:suggestion +csharp_style_namespace_declarations = file_scoped:silent +csharp_style_prefer_method_group_conversion = true:silent +csharp_style_prefer_top_level_statements = true:silent # Expression-level preferences -csharp_prefer_simple_default_expression = true -csharp_style_deconstructed_variable_declaration = true -csharp_style_implicit_object_creation_when_type_is_apparent = true -csharp_style_inlined_variable_declaration = true -csharp_style_prefer_index_operator = true -csharp_style_prefer_local_over_anonymous_function = true -csharp_style_prefer_null_check_over_type_check = true -csharp_style_prefer_range_operator = true -csharp_style_prefer_tuple_swap = true -csharp_style_prefer_utf8_string_literals = true -csharp_style_throw_expression = true -csharp_style_unused_value_assignment_preference = discard_variable -csharp_style_unused_value_expression_statement_preference = discard_variable +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_prefer_index_operator = true:suggestion +csharp_style_prefer_local_over_anonymous_function = true:suggestion +csharp_style_prefer_null_check_over_type_check = true:suggestion +csharp_style_prefer_range_operator = true:suggestion +csharp_style_prefer_tuple_swap = true:suggestion +csharp_style_prefer_utf8_string_literals = true:suggestion +csharp_style_throw_expression = true:suggestion +csharp_style_unused_value_assignment_preference = discard_variable:suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable:silent # 'using' directive preferences -csharp_using_directive_placement = inside_namespace +csharp_using_directive_placement = inside_namespace:silent # New line preferences -csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true -csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false -csharp_style_allow_embedded_statements_on_same_line_experimental = false +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:silent +csharp_style_allow_embedded_statements_on_same_line_experimental = false:silent #### C# Formatting Rules #### @@ -296,6 +305,11 @@ csharp_space_between_square_brackets = false # Wrapping preferences csharp_preserve_single_line_blocks = true csharp_preserve_single_line_statements = true +csharp_style_prefer_primary_constructors = false:suggestion +csharp_style_prefer_readonly_struct_member = true:suggestion +csharp_style_prefer_readonly_struct = true:suggestion +csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent +csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent # C# generated files @@ -307,6 +321,3 @@ generated_code = true [*.vb] # Modifier preferences visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async - - - diff --git a/.gitattributes b/.gitattributes index b064dcd65..92e024d03 100644 --- a/.gitattributes +++ b/.gitattributes @@ -67,6 +67,3 @@ MAKEFILE text eol=crlf *.PDF diff=astextplain *.rtf diff=astextplain *.RTF diff=astextplain - - - diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8c91063a2..3a72b0dfe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: os: [windows-latest, ubuntu-latest, macos-latest] project: - 'Castle.Facilities.NHibernateIntegration.sln' - framework: [net7.0, net6.0, net48] + framework: [net8.0, net7.0, net6.0, net48] configuration: [Release] exclude: - os: ubuntu-latest @@ -36,6 +36,12 @@ jobs: - name: Checkout Source Code uses: actions/checkout@v3 + - name: Setup .NET 8.0 SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + if: ${{ startswith(matrix.framework, 'net8.') }} + - name: Setup .NET 7.0 SDK uses: actions/setup-dotnet@v3 with: diff --git a/.gitignore b/.gitignore index d47f4e545..51c2a1030 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,11 @@ ## https://github.com/github/gitignore -src/*/bin/ -src/*/obj/ -lib/packages/ -packages/ +.vs/ +.idea/ build/ bin/ -log/ obj/ -temp/ -.vs/ -.idea/ +log/ *.suo *.user @@ -19,6 +14,3 @@ temp/ *.log *.cache Thumbs.db - - - diff --git a/CHANGELOG.md b/CHANGELOG.md index 29438f2fa..f068f68c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,11 @@ # Castle.Facilities.NHibernateIntegration - Changelog -## 5.4.0 (2023-xx-xx) +## 5.4.0 (2024-xx-xx) Improvements: -- Added .NET 7.0 support +- Added .NET 8.0 and .NET 7.0 support - Updated [System.Data.SqlClient] version to 4.8.5 -- Updated [NHibernate] version to 5.4.6 +- Updated [NHibernate] version to 5.4.7 Breaking Changes: - Upgraded [Castle.Core] version to 5.1.1 (TBD) diff --git a/Castle.Facilities.NHibernateIntegration.sln b/Castle.Facilities.NHibernateIntegration.sln index 8534d7d03..f15ccf949 100644 --- a/Castle.Facilities.NHibernateIntegration.sln +++ b/Castle.Facilities.NHibernateIntegration.sln @@ -2,24 +2,35 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.2.32616.157 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Castle Build", "Castle Build", "{31144CF9-AFCB-4A8C-80A7-3A834D6AAFE2}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Castle", "Castle", "{31144CF9-AFCB-4A8C-80A7-3A834D6AAFE2}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig .gitattributes = .gitattributes .gitignore = .gitignore + CHANGELOG.md = CHANGELOG.md + CONTRIBUTING.md = CONTRIBUTING.md + LICENSE = LICENSE + README.md = README.md + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{34CB1007-C1A1-4CCE-A4C9-56FCFE3988DD}" + ProjectSection(SolutionItems) = preProject appveyor.yml = appveyor.yml build.cmd = build.cmd - buildscripts\build.cmd = buildscripts\build.cmd build.sh = build.sh BuildPackages.cmd = BuildPackages.cmd - buildscripts\BuildPackages.cmd = buildscripts\BuildPackages.cmd - CHANGELOG.md = CHANGELOG.md CleanPackages.cmd = CleanPackages.cmd + Directory.Build.props = Directory.Build.props + Directory.Build.targets = Directory.Build.targets + Directory.Packages.props = Directory.Packages.props + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "buildscripts", "buildscripts", "{D7F0D6E6-A41E-4F41-B7FD-65B07D5BA6E0}" + ProjectSection(SolutionItems) = preProject + buildscripts\build.cmd = buildscripts\build.cmd + buildscripts\BuildPackages.cmd = buildscripts\BuildPackages.cmd buildscripts\common.props = buildscripts\common.props buildscripts\CommonAssemblyInfo.cs = buildscripts\CommonAssemblyInfo.cs - CONTRIBUTING.md = CONTRIBUTING.md - LICENSE = LICENSE - README.md = README.md EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub Actions", "GitHub Actions", "{47F2F74D-7773-450C-B6E7-2D3B7C8814A8}" @@ -27,6 +38,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub Actions", "GitHub Ac .github\workflows\build.yml = .github\workflows\build.yml EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{CD342E79-A425-4922-8CFE-4B990EACF71E}" + ProjectSection(SolutionItems) = preProject + src\Directory.Build.props = src\Directory.Build.props + src\Directory.Build.targets = src\Directory.Build.targets + EndProjectSection +EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Castle.Facilities.NHibernateIntegration", "src\Castle.Facilities.NHibernateIntegration\Castle.Facilities.NHibernateIntegration.csproj", "{5E3FDB17-A6C1-4FA2-8834-17AA672746D5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Castle.Facilities.NHibernateIntegration.Tests", "src\Castle.Facilities.NHibernateIntegration.Tests\Castle.Facilities.NHibernateIntegration.Tests.csproj", "{1D68E0C9-FFC1-4271-8194-1AD17C318433}" @@ -50,7 +67,10 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {47F2F74D-7773-450C-B6E7-2D3B7C8814A8} = {31144CF9-AFCB-4A8C-80A7-3A834D6AAFE2} + {47F2F74D-7773-450C-B6E7-2D3B7C8814A8} = {34CB1007-C1A1-4CCE-A4C9-56FCFE3988DD} + {34CB1007-C1A1-4CCE-A4C9-56FCFE3988DD} = {31144CF9-AFCB-4A8C-80A7-3A834D6AAFE2} + {D7F0D6E6-A41E-4F41-B7FD-65B07D5BA6E0} = {34CB1007-C1A1-4CCE-A4C9-56FCFE3988DD} + {CD342E79-A425-4922-8CFE-4B990EACF71E} = {34CB1007-C1A1-4CCE-A4C9-56FCFE3988DD} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {A4EC0140-6DD7-4D6D-8F91-38F891D8DC44} diff --git a/Castle.Facilities.NHibernateIntegration.sln.licenseheader b/Castle.Facilities.NHibernateIntegration.sln.licenseheader index 6d1abbec5..2b4614686 100644 --- a/Castle.Facilities.NHibernateIntegration.sln.licenseheader +++ b/Castle.Facilities.NHibernateIntegration.sln.licenseheader @@ -1,7 +1,7 @@ extensions: designer.cs generated.cs extensions: .cs .cpp .h #region License -// Copyright 2004-2022 Castle Project - https://www.castleproject.org/ +// Copyright 2004-2024 Castle Project - https://www.castleproject.org/ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ extensions: .cs .cpp .h extensions: .vb #Region License -' Copyright 2004-2022 Castle Project - https://www.castleproject.org/ +' Copyright 2004-2024 Castle Project - https://www.castleproject.org/ ' ' Licensed under the Apache License, Version 2.0 (the "License"); ' you may not use this file except in compliance with the License. diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 000000000..fe81abdb0 --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,36 @@ + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/appveyor.yml b/appveyor.yml index 8e6a1ebf7..6cb5f33ab 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -56,6 +56,8 @@ for: after_build: - ps: | $wc = New-Object System.Net.WebClient + $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path "build\Release\Castle.Facilities.NHibernateIntegration.Tests_net8.0_TestResults.xml")) + $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path "build\Release\Castle.Facilities.NHibernateIntegration.Tests_net7.0_TestResults.xml")) $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path "build\Release\Castle.Facilities.NHibernateIntegration.Tests_net6.0_TestResults.xml")) $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path "build\Release\Castle.Facilities.NHibernateIntegration.Tests_net48_TestResults.xml")) diff --git a/build.sh b/build.sh index e14e8eaa5..1fc804c3b 100644 --- a/build.sh +++ b/build.sh @@ -42,6 +42,18 @@ echo "OSNAME: $OSNAME" dotnet build "Castle.Facilities.NHibernateIntegration.sln" --configuration Release || exit 1 +echo ------------------------------------ +echo Running .NET (net8.0) Unit Tests +echo ------------------------------------ + +dotnet test "src\Castle.Facilities.NHibernateIntegration.Tests\bin\Release\net8.0\Castle.Facilities.NHibernateIntegration.Tests.dll" --results-directory "build\Release" --logger "nunit;LogFileName=Castle.Facilities.NHibernateIntegration.Tests_net8.0_TestResults.xml;format=nunit3" || exit 1 + +echo ------------------------------------ +echo Running .NET (net7.0) Unit Tests +echo ------------------------------------ + +dotnet test "src\Castle.Facilities.NHibernateIntegration.Tests\bin\Release\net7.0\Castle.Facilities.NHibernateIntegration.Tests.dll" --results-directory "build\Release" --logger "nunit;LogFileName=Castle.Facilities.NHibernateIntegration.Tests_net7.0_TestResults.xml;format=nunit3" || exit 1 + echo ------------------------------------ echo Running .NET (net6.0) Unit Tests echo ------------------------------------ @@ -62,6 +74,20 @@ if [[ !( -f "build\Release\Castle.Facilities.NHibernateIntegration.Tests_net6.0_ fi # Unit Test Failures +NET_FAILCOUNT=$(grep -F "One or more child tests had errors." "build\Release\Castle.Facilities.NHibernateIntegration.Tests_net8.0_TestResults.xml" | wc -l) +if [ $NET_FAILCOUNT -ne 0 ] +then + echo ".NET (net8.0) Unit Tests have failed, failing the build." + exit 1 +fi + +NET_FAILCOUNT=$(grep -F "One or more child tests had errors." "build\Release\Castle.Facilities.NHibernateIntegration.Tests_net7.0_TestResults.xml" | wc -l) +if [ $NET_FAILCOUNT -ne 0 ] +then + echo ".NET (net7.0) Unit Tests have failed, failing the build." + exit 1 +fi + NET_FAILCOUNT=$(grep -F "One or more child tests had errors." "build\Release\Castle.Facilities.NHibernateIntegration.Tests_net6.0_TestResults.xml" | wc -l) if [ $NET_FAILCOUNT -ne 0 ] then diff --git a/buildscripts/common.props b/buildscripts/common.props index 32569d7ea..59d3b8d57 100644 --- a/buildscripts/common.props +++ b/buildscripts/common.props @@ -72,9 +72,9 @@ - + - + - + diff --git a/src/Castle.Facilities.NHibernateIntegration.Tests/App.config b/src/Castle.Facilities.NHibernateIntegration.Tests/App.config index c3bbf28c8..8dd4dcb18 100644 --- a/src/Castle.Facilities.NHibernateIntegration.Tests/App.config +++ b/src/Castle.Facilities.NHibernateIntegration.Tests/App.config @@ -15,7 +15,4 @@ value="Server=.; Initial Catalog=test2; Integrated Security=SSPI" /> - - - diff --git a/src/Castle.Facilities.NHibernateIntegration.Tests/Castle.Facilities.NHibernateIntegration.Tests.csproj b/src/Castle.Facilities.NHibernateIntegration.Tests/Castle.Facilities.NHibernateIntegration.Tests.csproj index fcbd6d984..a92877448 100644 --- a/src/Castle.Facilities.NHibernateIntegration.Tests/Castle.Facilities.NHibernateIntegration.Tests.csproj +++ b/src/Castle.Facilities.NHibernateIntegration.Tests/Castle.Facilities.NHibernateIntegration.Tests.csproj @@ -1,8 +1,9 @@ - net7.0;net6.0;net48 + net8.0;net7.0;net6.0;net48 + true Exe Program @@ -15,31 +16,29 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - + + + + + - + @@ -51,7 +50,10 @@ - + + PreserveNewest + + PreserveNewest diff --git a/src/Castle.Facilities.NHibernateIntegration.Tests/Components/ReflectionUtilityTests.cs b/src/Castle.Facilities.NHibernateIntegration.Tests/Components/ReflectionUtilityTests.cs index a817309d1..1f5e50935 100644 --- a/src/Castle.Facilities.NHibernateIntegration.Tests/Components/ReflectionUtilityTests.cs +++ b/src/Castle.Facilities.NHibernateIntegration.Tests/Components/ReflectionUtilityTests.cs @@ -38,7 +38,7 @@ public void CanGetPropertiesAsDictionary() Name = "osman", Items = new List() { - new BlogItem { } + new() { } } }; var dictionary = ReflectionUtility.GetPropertiesDictionary(blog); @@ -51,10 +51,10 @@ public void CanGetPropertiesAsDictionary() [Test] public void SimpleTypeReturnsTrueForEnumStringDatetimeAndPrimitiveTypes() { - Assert.True(ReflectionUtility.IsSimpleType(typeof(string))); - Assert.True(ReflectionUtility.IsSimpleType(typeof(DateTime))); - Assert.True(ReflectionUtility.IsSimpleType(typeof(MyEnum))); - Assert.True(ReflectionUtility.IsSimpleType(typeof(char))); + Assert.That(ReflectionUtility.IsSimpleType(typeof(string)), Is.True); + Assert.That(ReflectionUtility.IsSimpleType(typeof(DateTime)), Is.True); + Assert.That(ReflectionUtility.IsSimpleType(typeof(MyEnum)), Is.True); + Assert.That(ReflectionUtility.IsSimpleType(typeof(char)), Is.True); } } } diff --git a/src/Castle.Facilities.NHibernateIntegration.Tests/Issues/Facilities116/Fixture.cs b/src/Castle.Facilities.NHibernateIntegration.Tests/Issues/Facilities116/Fixture.cs index 048388895..26b36ea24 100644 --- a/src/Castle.Facilities.NHibernateIntegration.Tests/Issues/Facilities116/Fixture.cs +++ b/src/Castle.Facilities.NHibernateIntegration.Tests/Issues/Facilities116/Fixture.cs @@ -42,7 +42,7 @@ public class Fixture : IssueTestCase { private const string FilePath = "myconfig.dat"; - private readonly Func> _objectPersisterMethod = + private readonly Func> _objectPersister = () => ObjectPersisterFactory.Create(); private IConfiguration _facilityConfiguration; @@ -61,7 +61,7 @@ public void CanCreateSerializedFileInTheDisk() _configurationBuilder.GetConfiguration(_facilityConfiguration); Assert.That(File.Exists(FilePath), Is.True); - var persister = _objectPersisterMethod(); + var persister = _objectPersister(); var configuration = persister.Read(FilePath); Assert.That(configuration, Is.Not.Null); diff --git a/src/Castle.Facilities.NHibernateIntegration/Castle.Facilities.NHibernateIntegration.csproj b/src/Castle.Facilities.NHibernateIntegration/Castle.Facilities.NHibernateIntegration.csproj index 9c93fcd55..26c74d299 100644 --- a/src/Castle.Facilities.NHibernateIntegration/Castle.Facilities.NHibernateIntegration.csproj +++ b/src/Castle.Facilities.NHibernateIntegration/Castle.Facilities.NHibernateIntegration.csproj @@ -1,7 +1,7 @@ - net7.0;net6.0;net48 + net8.0;net7.0;net6.0;net48 @@ -17,14 +17,14 @@ - - - - - - + + + + + + - + diff --git a/src/Castle.Facilities.NHibernateIntegration/Components/Dao/DataException.cs b/src/Castle.Facilities.NHibernateIntegration/Components/Dao/DataException.cs index 3633218bd..dc83219d8 100644 --- a/src/Castle.Facilities.NHibernateIntegration/Components/Dao/DataException.cs +++ b/src/Castle.Facilities.NHibernateIntegration/Components/Dao/DataException.cs @@ -45,6 +45,7 @@ public DataException(string message, Exception inner) : base(message, inner) { } +#if NETFRAMEWORK /// /// Initializes a new instance of the class. /// @@ -53,5 +54,6 @@ public DataException(string message, Exception inner) : base(message, inner) public DataException(SerializationInfo info, StreamingContext context) : base(info, context) { } +#endif } } diff --git a/src/Castle.Facilities.NHibernateIntegration/Util/ArrayPoolExtensions.cs b/src/Castle.Facilities.NHibernateIntegration/Util/ArrayPoolExtensions.cs index 81dfaa026..0aca87f14 100644 --- a/src/Castle.Facilities.NHibernateIntegration/Util/ArrayPoolExtensions.cs +++ b/src/Castle.Facilities.NHibernateIntegration/Util/ArrayPoolExtensions.cs @@ -10,19 +10,34 @@ public static class ArrayPoolExtensions { public static ArrayPoolAllocation Allocate(this ArrayPool pool, int minimumLength, - bool clearBufferContents = false) + bool clearBufferContents = true) { return new ArrayPoolAllocation(pool, minimumLength, clearBufferContents); } public static ArrayPoolByteAllocation AllocateByte(this ArrayPool pool, int minimumLength, - bool clearBufferContents = false) + bool clearBufferContents = true) { return new ArrayPoolByteAllocation(pool, minimumLength, clearBufferContents); } } + /// + /// + /// + /// + /// + /// REFERENCES: + /// - + /// - + /// - + /// - + /// - + /// +#if NET + [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Not needed.")] +#endif public readonly struct ArrayPoolAllocation : IDisposable { private readonly ArrayPool _pool; @@ -38,20 +53,23 @@ internal ArrayPoolAllocation(ArrayPool pool, Buffer = _pool.Rent(minimumLength); } - public T[] Buffer { get; } - public void Dispose() { if (_clearBufferContents) { // https://github.com/dotnet/runtime/discussions/48697 - Buffer.AsSpan(0, Buffer.Length).Clear(); + Buffer.AsSpan().Clear(); } _pool.Return(Buffer); } + + public T[] Buffer { get; } } +#if NET + [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Not needed.")] +#endif public readonly struct ArrayPoolByteAllocation : IDisposable { private readonly ArrayPool _pool; @@ -67,21 +85,21 @@ internal ArrayPoolByteAllocation(ArrayPool pool, Buffer = _pool.Rent(minimumLength); } - public byte[] Buffer { get; } - public void Dispose() { if (_clearBufferContents) { // https://github.com/dotnet/runtime/discussions/48697 #if NET - CryptographicOperations.ZeroMemory(Buffer.AsSpan(0, Buffer.Length)); + CryptographicOperations.ZeroMemory(Buffer.AsSpan()); #else - Buffer.AsSpan(0, Buffer.Length).Clear(); + Buffer.AsSpan().Clear(); #endif } _pool.Return(Buffer); } + + public byte[] Buffer { get; } } } diff --git a/tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.csproj b/tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.csproj index d9a877bf8..9d6688fa6 100644 --- a/tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.csproj +++ b/tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.csproj @@ -9,7 +9,7 @@ - + diff --git a/tools/Explicit.NuGet.Versions/Program.cs b/tools/Explicit.NuGet.Versions/Program.cs index 2a97b1fc7..5f21a3bd3 100644 --- a/tools/Explicit.NuGet.Versions/Program.cs +++ b/tools/Explicit.NuGet.Versions/Program.cs @@ -91,7 +91,7 @@ private static void SetPackageDependencyVersionsToBeExplicitForXmlDocument(XmlDo { if (node.Name.ToLowerInvariant() == "dependency" && !string.IsNullOrEmpty(node.Attributes["id"].Value) && - node.Attributes["id"].Value.StartsWith(nugetIdFilter, StringComparison.InvariantCultureIgnoreCase)) + node.Attributes["id"].Value.StartsWith(nugetIdFilter, StringComparison.OrdinalIgnoreCase)) { var currentVersion = node.Attributes["version"].Value; if (!node.Attributes["version"].Value.StartsWith("[") &&