diff --git a/.editorconfig b/.editorconfig
index 1d82f31..9f1a417 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,28 +1,199 @@
-; EditorConfig to support per-solution formatting.
-; Use the EditorConfig VS add-in to make this work.
-; http://editorconfig.org/
-
-; This is the default for the codeline.
-root = true
-
-[*]
-end_of_line = CRLF
-
-[*.{config,cs,xml}]
-indent_style = space
-indent_size = 4
-trim_trailing_whitespace = true
-
-[*.{proj,props,sln,targets}]
-indent_style = tab
-trim_trailing_whitespace = true
-
-[*.{kproj,csproj,json,ps1,psd1,psm1,resx,rst}]
-indent_style = space
-indent_size = 2
-trim_trailing_whitespace = true
-
-[NuGet.Config]
-indent_style = space
-indent_size = 2
-trim_trailing_whitespace = true
+; EditorConfig to support per-solution formatting.
+; Use the EditorConfig VS add-in to make this work.
+; http://editorconfig.org/
+
+; This is the default for the codeline.
+root = true
+
+[*]
+indent_style = space
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+; .NET Code - almost, but not exactly, the same suggestions as corefx
+; https://github.com/dotnet/corefx/blob/master/.editorconfig
+[*.cs]
+indent_size = 4
+charset = utf-8-bom
+
+; New line preferences
+csharp_new_line_before_open_brace = all
+csharp_new_line_before_else = true
+csharp_new_line_before_catch = true
+csharp_new_line_before_finally = true
+csharp_new_line_before_members_in_object_initializers = true
+csharp_new_line_before_members_in_anonymous_types = true
+csharp_new_line_between_query_expression_clauses = true
+
+; Indentation preferences
+csharp_indent_block_contents = true
+csharp_indent_braces = false
+csharp_indent_case_contents = true
+csharp_indent_case_contents_when_block = true
+csharp_indent_switch_labels = true
+csharp_indent_labels = one_less_than_current
+
+; Modifier preferences
+csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
+
+; Avoid this. unless absolutely necessary
+dotnet_style_qualification_for_field = false:suggestion
+dotnet_style_qualification_for_property = false:suggestion
+dotnet_style_qualification_for_method = false:suggestion
+dotnet_style_qualification_for_event = false:suggestion
+
+; Types: use keywords instead of BCL types, using var is fine.
+csharp_style_var_when_type_is_apparent = false:none
+dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
+dotnet_style_predefined_type_for_member_access = true:suggestion
+
+; Name all constant fields using PascalCase
+dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = warning
+dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
+dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
+dotnet_naming_symbols.constant_fields.applicable_kinds = field
+dotnet_naming_symbols.constant_fields.required_modifiers = const
+dotnet_naming_style.pascal_case_style.capitalization = pascal_case
+
+; Static fields should be _camelCase
+dotnet_naming_rule.static_fields_should_be_camel_case.severity = warning
+dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
+dotnet_naming_rule.static_fields_should_be_camel_case.style = camel_case_underscore_style
+dotnet_naming_symbols.static_fields.applicable_kinds = field
+dotnet_naming_symbols.static_fields.required_modifiers = static
+dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
+
+; Static readonly fields should be PascalCase
+dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.severity = warning
+dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.symbols = static_readonly_fields
+dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.style = pascal_case_style
+dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field
+dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly
+dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = private, internal, private_protected
+
+; Internal and private fields should be _camelCase
+dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning
+dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
+dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
+dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
+dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
+dotnet_naming_style.camel_case_underscore_style.required_prefix = _
+dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
+
+; Code style defaults
+csharp_using_directive_placement = outside_namespace:suggestion
+dotnet_sort_system_directives_first = true
+csharp_prefer_braces = true:refactoring
+csharp_preserve_single_line_blocks = true:none
+csharp_preserve_single_line_statements = false:none
+csharp_prefer_static_local_function = true:suggestion
+csharp_prefer_simple_using_statement = false:none
+csharp_style_prefer_switch_expression = true:suggestion
+
+; Code quality
+dotnet_style_readonly_field = true:suggestion
+dotnet_code_quality_unused_parameters = non_public:suggestion
+
+; Expression-level preferences
+dotnet_style_object_initializer = true:suggestion
+dotnet_style_collection_initializer = true:suggestion
+dotnet_style_explicit_tuple_names = true:suggestion
+dotnet_style_coalesce_expression = true:suggestion
+dotnet_style_null_propagation = true:suggestion
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
+dotnet_style_prefer_inferred_tuple_names = true:suggestion
+dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
+dotnet_style_prefer_auto_properties = true:suggestion
+dotnet_style_prefer_conditional_expression_over_assignment = true:refactoring
+dotnet_style_prefer_conditional_expression_over_return = true:refactoring
+csharp_prefer_simple_default_expression = true:suggestion
+
+# Expression-bodied members
+csharp_style_expression_bodied_methods = true:refactoring
+csharp_style_expression_bodied_constructors = true:refactoring
+csharp_style_expression_bodied_operators = true:refactoring
+csharp_style_expression_bodied_properties = true:refactoring
+csharp_style_expression_bodied_indexers = true:refactoring
+csharp_style_expression_bodied_accessors = true:refactoring
+csharp_style_expression_bodied_lambdas = true:refactoring
+csharp_style_expression_bodied_local_functions = true:refactoring
+
+# Pattern matching
+csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
+csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
+csharp_style_inlined_variable_declaration = true:suggestion
+
+# Null checking preferences
+csharp_style_throw_expression = true:suggestion
+csharp_style_conditional_delegate_call = true:suggestion
+
+# Other features
+csharp_style_namespace_declarations = file_scoped:suggestion
+csharp_style_prefer_index_operator = false:none
+csharp_style_prefer_range_operator = false:none
+csharp_style_pattern_local_over_anonymous_function = false:none
+
+# Space preferences
+csharp_space_after_cast = false
+csharp_space_after_colon_in_inheritance_clause = true
+csharp_space_after_comma = true
+csharp_space_after_dot = false
+csharp_space_after_keywords_in_control_flow_statements = true
+csharp_space_after_semicolon_in_for_statement = true
+csharp_space_around_binary_operators = before_and_after
+csharp_space_around_declaration_statements = do_not_ignore
+csharp_space_before_colon_in_inheritance_clause = true
+csharp_space_before_comma = false
+csharp_space_before_dot = false
+csharp_space_before_open_square_brackets = false
+csharp_space_before_semicolon_in_for_statement = false
+csharp_space_between_empty_square_brackets = false
+csharp_space_between_method_call_empty_parameter_list_parentheses = false
+csharp_space_between_method_call_name_and_opening_parenthesis = false
+csharp_space_between_method_call_parameter_list_parentheses = false
+csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
+csharp_space_between_method_declaration_name_and_open_parenthesis = false
+csharp_space_between_method_declaration_parameter_list_parentheses = false
+csharp_space_between_parentheses = false
+csharp_space_between_square_brackets = false
+
+; .NET project files and MSBuild - match defaults for VS
+[*.{csproj,nuspec,proj,projitems,props,shproj,targets,vbproj,vcxproj,vcxproj.filters,vsixmanifest,vsct}]
+indent_size = 2
+
+; .NET solution files - match defaults for VS
+[*.sln]
+indent_style = tab
+
+; Config - match XML and default nuget.config template
+[*.config]
+indent_size = 2
+
+; Resources - match defaults for VS
+[*.resx]
+indent_size = 2
+
+; Static analysis rulesets - match defaults for VS
+[*.ruleset]
+indent_size = 2
+
+; HTML, XML - match defaults for VS
+[*.{cshtml,html,xml}]
+indent_size = 4
+
+; JavaScript and JS mixes - match eslint settings; JSON also matches .NET Core templates
+[*.{js,json,ts,vue}]
+indent_size = 2
+
+; Markdown - match markdownlint settings
+[*.{md,markdown}]
+indent_size = 2
+
+; PowerShell - match defaults for New-ModuleManifest and PSScriptAnalyzer Invoke-Formatter
+[*.{ps1,psd1,psm1}]
+indent_size = 4
+charset = utf-8-bom
+
+; ReStructuredText - standard indentation format from examples
+[*.rst]
+indent_size = 2
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
new file mode 100644
index 0000000..5068a91
--- /dev/null
+++ b/.git-blame-ignore-revs
@@ -0,0 +1,11 @@
+# Ignore revisions in git blame - set your git config to use the file by convention:
+# git config blame.ignoreRevsFile .git-blame-ignore-revs
+#
+# Optional additional git config:
+# Mark any lines that have had a commit skipped using --ignore-rev with a `?`
+# git config --global blame.markIgnoredLines true
+# Mark any lines that were added in a skipped commit and can not be attributed with a `*`
+# git config --global blame.markUnblamableLines true
+
+# Convert to file-scoped namespaces.
+62f462553429f464859fbc97fe0c7f25dad66663
diff --git a/CodeAnalysisDictionary.xml b/CodeAnalysisDictionary.xml
deleted file mode 100644
index 0f1b469..0000000
--- a/CodeAnalysisDictionary.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
-
- Api
- Autofac
- autowired
- autowiring
- composable
- configurator
- Ioc
- Mef
- Moq
- multitenancy
- Mvc
- Mvx
- Mvvm
- startable
- Owin
-
-
-
-
-
diff --git a/Full.ruleset b/Full.ruleset
deleted file mode 100644
index 417a489..0000000
--- a/Full.ruleset
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
index 31ff099..517a067 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,38 @@
# Autofac.SignalR
-SignalR integration for [Autofac](https://autofac.org).
+ASP.NET classic SignalR integration for [Autofac](https://autofac.org).
[![Build status](https://ci.appveyor.com/api/projects/status/b90fy9gig8jxcq2g?svg=true)](https://ci.appveyor.com/project/Autofac/autofac-signalr)
-Please file issues and pull requests for this package in this repository rather than in the Autofac core repo.
+Please file issues and pull requests for this package [in this repository](https://github.com/autofac/Autofac.SignalR/issues) rather than in the Autofac core repo.
+
+If you're working with ASP.NET Core, you want [Autofac.Extensions.DependencyInjection](https://www.nuget.org/packages/Autofac.Extensions.DependencyInjection), not this package.
- [Documentation](https://autofac.readthedocs.io/en/latest/integration/signalr.html)
- [NuGet](https://www.nuget.org/packages/Autofac.SignalR2/)
- [Contributing](https://autofac.readthedocs.io/en/latest/contributors.html)
+- [Open in Visual Studio Code](https://open.vscode.dev/autofac/Autofac.SignalR)
+
+## Quick Start
+
+To get Autofac integrated with SignalR you need to reference the SignalR integration NuGet package, register your hubs, and set the dependency resolver.
+
+```c#
+protected void Application_Start()
+{
+ var builder = new ContainerBuilder();
+
+ // Register your SignalR hubs.
+ builder.RegisterHubs(Assembly.GetExecutingAssembly());
+
+ // Set the dependency resolver to be Autofac.
+ var container = builder.Build();
+ GlobalHost.DependencyResolver = new AutofacDependencyResolver(container);
+}
+```
+
+Check out the [Autofac SignalR integration documentation](https://autofac.readthedocs.io/en/latest/integration/signalr.html) for more information.
+
+## Get Help
+
+**Need help with Autofac?** We have [a documentation site](https://autofac.readthedocs.io/) as well as [API documentation](https://autofac.org/apidoc/). We're ready to answer your questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/autofac) or check out the [discussion forum](https://groups.google.com/forum/#forum/autofac).
diff --git a/appveyor.yml b/appveyor.yml
index e47dd00..0edfbc8 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,33 +1,39 @@
-image: Visual Studio 2019
+image: Visual Studio 2022
-version: 6.0.0.{build}
+version: "6.1.0.{build}"
dotnet_csproj:
- version_prefix: '6.0.0'
+ version_prefix: "6.1.0"
patch: true
file: 'src\**\*.csproj'
-
+
configuration: Release
+environment:
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
+ NUGET_XMLDOC_MODE: skip
+
skip_tags: true
nuget:
disable_publish_on_pr: true
-
+
clone_depth: 1
-test: off
+test: false
build_script:
- - ps: .\build.ps1
-
+ - pwsh: .\build.ps1
+
artifacts:
-- path: artifacts\packages\**\*.nupkg
- name: MyGet
+ - path: artifacts\packages\**\*.*nupkg
+ name: MyGet
+ type: NuGetPackage
deploy:
-- provider: NuGet
- server: https://www.myget.org/F/autofac/api/v2/package
- api_key:
- secure: rCUEY75fXN0wxtMy6QL4jCrLdaYbxIBzIXWeN+wEu/XDpyqimzreOc5AH5jMd5ah
- symbol_server: https://www.myget.org/F/autofac/symbols/api/v2/package
+ - provider: NuGet
+ server: https://www.myget.org/F/autofac/api/v2/package
+ symbol_server: https://www.myget.org/F/autofac/api/v2/package
+ api_key:
+ secure: xUXExgVAagrdEicCjSxsQVrwiLo2TtnfqMbYB9Cauq2cpbm/EVz957PBK0v/GEYq
+ artifact: MyGet
diff --git a/build.ps1 b/build.ps1
index 1d154bd..eedeaa2 100644
--- a/build.ps1
+++ b/build.ps1
@@ -3,44 +3,67 @@
########################
Push-Location $PSScriptRoot
-Import-Module $PSScriptRoot\Build\Autofac.Build.psd1 -Force
+try {
+ Import-Module $PSScriptRoot/build/Autofac.Build.psd1 -Force
-$artifactsPath = "$PSScriptRoot\artifacts"
-$packagesPath = "$artifactsPath\packages"
-$sdkVersion = (Get-Content "$PSScriptRoot\global.json" | ConvertFrom-Json).sdk.version
+ $artifactsPath = "$PSScriptRoot/artifacts"
+ $packagesPath = "$artifactsPath/packages"
-# Clean up artifacts folder
-if (Test-Path $artifactsPath) {
- Write-Message "Cleaning $artifactsPath folder"
- Remove-Item $artifactsPath -Force -Recurse
-}
+ $globalJson = (Get-Content "$PSScriptRoot/global.json" | ConvertFrom-Json -NoEnumerate);
+
+ $sdkVersion = $globalJson.sdk.version
+
+ # Clean up artifacts folder
+ if (Test-Path $artifactsPath) {
+ Write-Message "Cleaning $artifactsPath folder"
+ Remove-Item $artifactsPath -Force -Recurse
+ }
-# Install dotnet CLI
-Write-Message "Installing .NET Core SDK version $sdkVersion"
-Install-DotNetCli -Version $sdkVersion
+ # Install dotnet SDK versions during CI. In a local build we assume you have
+ # everything installed; on CI we'll force the install. If you install _any_
+ # SDKs, you have to install _all_ of them because you can't install SDKs in
+ # two different locations. dotnet CLI locates SDKs relative to the
+ # executable.
+ if ($Null -ne $env:APPVEYOR_BUILD_NUMBER) {
+ Install-DotNetCli -Version $sdkVersion
+ foreach ($additional in $globalJson.additionalSdks)
+ {
+ Install-DotNetCli -Version $additional;
+ }
+ }
-# Write out dotnet information
-& dotnet --info
+ # Write out dotnet information
+ & dotnet --info
-# Set version suffix
-$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
-$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
-$versionSuffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"]
+ # Set version suffix
+ $branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$NULL -ne $env:APPVEYOR_REPO_BRANCH];
+ $revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$NULL -ne $env:APPVEYOR_BUILD_NUMBER];
+ $versionSuffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)).Replace('/', '-'))-$revision" }[$branch -eq "master" -and $revision -ne "local"]
-Write-Message "Package version suffix is '$versionSuffix'"
+ Write-Message "Package version suffix is '$versionSuffix'"
-# Package restore
-Write-Message "Restoring packages"
-Get-DotNetProjectDirectory -RootPath $PSScriptRoot | Restore-DependencyPackages
+ # Package restore
+ Write-Message "Restoring packages"
+ Get-DotNetProjectDirectory -RootPath $PSScriptRoot | Restore-DependencyPackages
-# Build/package
-Write-Message "Building projects and packages"
-Get-DotNetProjectDirectory -RootPath $PSScriptRoot\src | Invoke-DotNetPack -PackagesPath $packagesPath -VersionSuffix $versionSuffix
+ # Build/package
+ Write-Message "Building projects and packages"
+ Get-DotNetProjectDirectory -RootPath $PSScriptRoot\src | Invoke-DotNetPack -PackagesPath $packagesPath -VersionSuffix $versionSuffix
-# Test
-Write-Message "Executing unit tests"
-Get-DotNetProjectDirectory -RootPath $PSScriptRoot\test | Invoke-Test
+ # Test
+ Write-Message "Executing unit tests"
+ Get-DotNetProjectDirectory -RootPath $PSScriptRoot\test | Invoke-Test
-# Finished
-Write-Message "Build finished"
-Pop-Location
+ if ($env:CI -eq "true") {
+ # Generate Coverage Report
+ Write-Message "Generating Codecov Report"
+ Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
+ & bash codecov.sh -f "artifacts/coverage/*/coverage*.info"
+ }
+
+ # Finished
+ Write-Message "Build finished"
+}
+finally {
+ Pop-Location
+}
diff --git a/build/Analyzers.ruleset b/build/Analyzers.ruleset
index 8e76993..4d4e23d 100644
--- a/build/Analyzers.ruleset
+++ b/build/Analyzers.ruleset
@@ -1,7 +1,16 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -25,13 +34,7 @@
-
-
-
-
-
-
-
+
@@ -41,9 +44,7 @@
-
-
-
\ No newline at end of file
+
diff --git a/build/Autofac.Build.psd1 b/build/Autofac.Build.psd1
index 5d93715..8a5bfac 100644
--- a/build/Autofac.Build.psd1
+++ b/build/Autofac.Build.psd1
@@ -1,6 +1,6 @@
@{
RootModule = '.\Autofac.Build.psm1'
- ModuleVersion = '0.2.0'
+ ModuleVersion = '0.3.0'
GUID = '55d3f738-f48f-4497-9b2c-ecd90ec1f978'
Author = 'Autofac Contributors'
CompanyName = 'Autofac'
@@ -12,4 +12,4 @@
ModuleList = @()
FileList = @()
PrivateData = ''
-}
\ No newline at end of file
+}
diff --git a/build/Autofac.Build.psm1 b/build/Autofac.Build.psm1
index 6cefea0..d61358b 100644
--- a/build/Autofac.Build.psm1
+++ b/build/Autofac.Build.psm1
@@ -1,90 +1,91 @@
-# EXIT CODES
+# EXIT CODES
# 1: dotnet packaging failure
# 2: dotnet publishing failure
# 3: Unit test failure
# 4: dotnet / NuGet package restore failure
<#
- .SYNOPSIS
- Writes a build progress message to the host.
+.SYNOPSIS
+ Gets the set of directories in which projects are available for compile/processing.
- .PARAMETER Message
- The message to write.
+.PARAMETER RootPath
+ Path where searching for project directories should begin.
#>
-function Write-Message
-{
- [CmdletBinding()]
- Param(
- [Parameter(Mandatory=$True, ValueFromPipeline=$False, ValueFromPipelineByPropertyName=$False)]
- [ValidateNotNullOrEmpty()]
- [string]
- $Message
- )
-
- Write-Host "[BUILD] $Message" -ForegroundColor Cyan
+function Get-DotNetProjectDirectory {
+ [CmdletBinding()]
+ Param(
+ [Parameter(Mandatory = $True, ValueFromPipeline = $False, ValueFromPipelineByPropertyName = $False)]
+ [ValidateNotNullOrEmpty()]
+ [string]
+ $RootPath
+ )
+
+ Get-ChildItem -Path $RootPath -Recurse -Include "*.csproj" | Select-Object @{ Name = "ParentFolder"; Expression = { $_.Directory.FullName.TrimEnd("\") } } | Select-Object -ExpandProperty ParentFolder
}
<#
- .SYNOPSIS
- Gets the set of directories in which projects are available for compile/processing.
-
- .PARAMETER RootPath
- Path where searching for project directories should begin.
+.SYNOPSIS
+ Runs the dotnet CLI install script from GitHub to install a project-local
+ copy of the CLI.
#>
-function Get-DotNetProjectDirectory
-{
- [CmdletBinding()]
- Param(
- [Parameter(Mandatory=$True, ValueFromPipeline=$False, ValueFromPipelineByPropertyName=$False)]
- [ValidateNotNullOrEmpty()]
- [string]
- $RootPath
- )
-
- Get-ChildItem -Path $RootPath -Recurse -Include "*.csproj" | Select-Object @{ Name="ParentFolder"; Expression={ $_.Directory.FullName.TrimEnd("\") } } | Select-Object -ExpandProperty ParentFolder
+function Install-DotNetCli {
+ [CmdletBinding()]
+ Param(
+ [string]
+ $Version = "Latest"
+ )
+ Write-Message "Installing .NET SDK version $Version"
+
+ $callerPath = Split-Path $MyInvocation.PSCommandPath
+ $installDir = Join-Path -Path $callerPath -ChildPath ".dotnet/cli"
+ if (!(Test-Path $installDir)) {
+ New-Item -ItemType Directory -Path "$installDir" | Out-Null
+ }
+
+ # Download the dotnet CLI install script
+ if ($IsWindows) {
+ if (!(Test-Path ./.dotnet/dotnet-install.ps1)) {
+ Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./.dotnet/dotnet-install.ps1"
+ }
+
+ & ./.dotnet/dotnet-install.ps1 -InstallDir "$installDir" -Version $Version
+ } else {
+ if (!(Test-Path ./.dotnet/dotnet-install.sh)) {
+ Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile "./.dotnet/dotnet-install.sh"
+ }
+
+ & bash ./.dotnet/dotnet-install.sh --install-dir "$installDir" --version $Version
+ }
+
+ Add-Path "$installDir"
}
<#
- .SYNOPSIS
- Runs the dotnet CLI install script from GitHub to install a project-local
- copy of the CLI.
+.SYNOPSIS
+ Appends a given value to the path but only if the value does not yet exist within the path.
+.PARAMETER Path
+ The path to append.
#>
-function Install-DotNetCli
-{
- [CmdletBinding()]
- Param(
- [string]
- $Version = "Latest"
- )
-
- if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue))
- {
- $installedVersion = dotnet --version
- if ($installedVersion -eq $Version)
- {
- Write-Message ".NET Core SDK version $Version is already installed"
+function Add-Path {
+ [CmdletBinding()]
+ Param(
+ [ValidateNotNullOrEmpty()]
+ [string]
+ $Path
+ )
+
+ $pathSeparator = ":";
+
+ if ($IsWindows) {
+ $pathSeparator = ";";
+ }
+
+ $pathValues = $env:PATH.Split($pathSeparator);
+ if ($pathValues -Contains $Path) {
return;
}
- }
-
- $callerPath = Split-Path $MyInvocation.PSCommandPath
- $installDir = Join-Path -Path $callerPath -ChildPath ".dotnet\cli"
- if (!(Test-Path $installDir))
- {
- New-Item -ItemType Directory -Path "$installDir" | Out-Null
- }
-
- # Download the dotnet CLI install script
- if (!(Test-Path .\dotnet\install.ps1))
- {
- Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile ".\.dotnet\dotnet-install.ps1"
- }
-
- # Run the dotnet CLI install
- & .\.dotnet\dotnet-install.ps1 -InstallDir "$installDir" -Version $Version
-
- # Add the dotnet folder path to the process.
- $env:PATH = "$installDir;$env:PATH"
+
+ $env:PATH = "${Path}${pathSeparator}$env:PATH"
}
<#
@@ -95,156 +96,162 @@ function Install-DotNetCli
.PARAMETER DirectoryName
The path to the directory containing the project to build.
#>
-function Invoke-DotNetBuild
-{
- [CmdletBinding()]
- Param(
- [Parameter(Mandatory=$True, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)]
- [ValidateNotNull()]
- [System.IO.DirectoryInfo[]]
- $ProjectDirectory
- )
- Process
- {
- foreach($Project in $ProjectDirectory)
- {
- & dotnet build ("""" + $Project.FullName + """") --configuration Release
- if ($LASTEXITCODE -ne 0)
- {
- exit 1
- }
+function Invoke-DotNetBuild {
+ [CmdletBinding()]
+ Param(
+ [Parameter(Mandatory = $True, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True)]
+ [ValidateNotNull()]
+ [System.IO.DirectoryInfo[]]
+ $ProjectDirectory
+ )
+ Process {
+ foreach ($Project in $ProjectDirectory) {
+ & dotnet build ("""" + $Project.FullName + """") --configuration Release
+ if ($LASTEXITCODE -ne 0) {
+ exit 1
+ }
+ }
}
- }
}
<#
- .SYNOPSIS
- Invokes the dotnet utility to package a project.
+.SYNOPSIS
+ Invokes the dotnet utility to package a project.
- .PARAMETER ProjectDirectory
- Path to the directory containing the project to package.
+.PARAMETER ProjectDirectory
+ Path to the directory containing the project to package.
- .PARAMETER PackagesPath
- Path to the "artifacts\packages" folder where packages should go.
+.PARAMETER PackagesPath
+ Path to the "artifacts/packages" folder where packages should go.
- .PARAMETER VersionSuffix
- The version suffix to use for the NuGet package version.
+.PARAMETER VersionSuffix
+ The version suffix to use for the NuGet package version.
#>
-function Invoke-DotNetPack
-{
- [CmdletBinding()]
- Param(
- [Parameter(Mandatory=$True, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)]
- [ValidateNotNull()]
- [System.IO.DirectoryInfo[]]
- $ProjectDirectory,
-
- [Parameter(Mandatory=$True, ValueFromPipeline=$False)]
- [ValidateNotNull()]
- [System.IO.DirectoryInfo]
- $PackagesPath,
-
- [Parameter(Mandatory=$True, ValueFromPipeline=$False)]
- [AllowEmptyString()]
- [string]
- $VersionSuffix
- )
- Begin
- {
- New-Item -Path $PackagesPath -ItemType Directory -Force | Out-Null
- }
- Process
- {
- foreach($Project in $ProjectDirectory)
- {
- if ($VersionSuffix -eq "")
- {
- & dotnet build ("""" + $Project.FullName + """") --configuration Release
- }
- else
- {
- & dotnet build ("""" + $Project.FullName + """") --configuration Release --version-suffix $VersionSuffix
- }
- if ($LASTEXITCODE -ne 0)
- {
- exit 1
- }
-
- if ($VersionSuffix -eq "")
- {
- & dotnet pack ("""" + $Project.FullName + """") --configuration Release --output $PackagesPath
- }
- else
- {
- & dotnet pack ("""" + $Project.FullName + """") --configuration Release --version-suffix $VersionSuffix --output $PackagesPath
- }
- if ($LASTEXITCODE -ne 0)
- {
- exit 1
- }
+function Invoke-DotNetPack {
+ [CmdletBinding()]
+ Param(
+ [Parameter(Mandatory = $True, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True)]
+ [ValidateNotNull()]
+ [System.IO.DirectoryInfo[]]
+ $ProjectDirectory,
+
+ [Parameter(Mandatory = $True, ValueFromPipeline = $False)]
+ [ValidateNotNull()]
+ [System.IO.DirectoryInfo]
+ $PackagesPath,
+
+ [Parameter(Mandatory = $True, ValueFromPipeline = $False)]
+ [AllowEmptyString()]
+ [string]
+ $VersionSuffix
+ )
+ Begin {
+ New-Item -Path $PackagesPath -ItemType Directory -Force | Out-Null
+ }
+ Process {
+ foreach ($Project in $ProjectDirectory) {
+ if ($VersionSuffix -eq "") {
+ & dotnet build ("""" + $Project.FullName + """") --configuration Release
+ }
+ else {
+ & dotnet build ("""" + $Project.FullName + """") --configuration Release --version-suffix $VersionSuffix
+ }
+ if ($LASTEXITCODE -ne 0) {
+ exit 1
+ }
+
+ if ($VersionSuffix -eq "") {
+ & dotnet pack ("""" + $Project.FullName + """") --configuration Release --output $PackagesPath
+ }
+ else {
+ & dotnet pack ("""" + $Project.FullName + """") --configuration Release --version-suffix $VersionSuffix --output $PackagesPath
+ }
+ if ($LASTEXITCODE -ne 0) {
+ exit 1
+ }
+ }
}
- }
}
<#
- .Synopsis
- Invokes dotnet test command.
+.SYNOPSIS
+ Invokes dotnet test command.
- .Parameter ProjectDirectory
- Path to the directory containing the project to package.
+.PARAMETER ProjectDirectory
+ Path to the directory containing the project to package.
#>
-function Invoke-Test
-{
- [CmdletBinding()]
- Param(
- [Parameter(Mandatory=$True, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)]
- [ValidateNotNull()]
- [System.IO.DirectoryInfo[]]
- $ProjectDirectory
- )
- Process
- {
- foreach($Project in $ProjectDirectory)
- {
- Push-Location $Project
-
- & dotnet test --configuration Release --logger:trx
- if ($LASTEXITCODE -ne 0)
- {
- Pop-Location
- exit 3
- }
-
- Pop-Location
+function Invoke-Test {
+ [CmdletBinding()]
+ Param(
+ [Parameter(Mandatory = $True, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True)]
+ [ValidateNotNull()]
+ [System.IO.DirectoryInfo[]]
+ $ProjectDirectory
+ )
+ Process {
+ foreach ($Project in $ProjectDirectory) {
+ Push-Location $Project
+
+ & dotnet test `
+ --configuration Release `
+ --logger:trx `
+ /p:CollectCoverage=true `
+ /p:CoverletOutput="../../artifacts/coverage/$($Project.Name)/" `
+ /p:CoverletOutputFormat="json%2clcov" `
+ /p:ExcludeByAttribute=CompilerGeneratedAttribute `
+ /p:ExcludeByAttribute=GeneratedCodeAttribute `
+ /p:Exclude="[Autofac.Test.Scenarios.ScannedAssembly]*"
+
+ if ($LASTEXITCODE -ne 0) {
+ Pop-Location
+ exit 3
+ }
+
+ Pop-Location
+ }
}
- }
}
<#
- .SYNOPSIS
- Restores dependencies using the dotnet utility.
+.SYNOPSIS
+ Restores dependencies using the dotnet utility.
- .PARAMETER ProjectDirectory
- Path to the directory containing the project with dependencies to restore.
+.PARAMETER ProjectDirectory
+ Path to the directory containing the project with dependencies to restore.
#>
-function Restore-DependencyPackages
-{
- [CmdletBinding()]
- Param(
- [Parameter(Mandatory=$True, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)]
- [ValidateNotNull()]
- [System.IO.DirectoryInfo[]]
- $ProjectDirectory
- )
- Process
- {
- foreach($Project in $ProjectDirectory)
- {
- & dotnet restore ("""" + $Project.FullName + """") --no-cache
- if($LASTEXITCODE -ne 0)
- {
- exit 4
- }
+function Restore-DependencyPackages {
+ [CmdletBinding()]
+ Param(
+ [Parameter(Mandatory = $True, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True)]
+ [ValidateNotNull()]
+ [System.IO.DirectoryInfo[]]
+ $ProjectDirectory
+ )
+ Process {
+ foreach ($Project in $ProjectDirectory) {
+ & dotnet restore ("""" + $Project.FullName + """") --no-cache
+ if ($LASTEXITCODE -ne 0) {
+ exit 4
+ }
+ }
}
- }
+}
+
+<#
+.SYNOPSIS
+ Writes a build progress message to the host.
+
+.PARAMETER Message
+ The message to write.
+#>
+function Write-Message {
+ [CmdletBinding()]
+ Param(
+ [Parameter(Mandatory = $True, ValueFromPipeline = $False, ValueFromPipelineByPropertyName = $False)]
+ [ValidateNotNullOrEmpty()]
+ [string]
+ $Message
+ )
+
+ Write-Host "[BUILD] $Message" -ForegroundColor Cyan
}
diff --git a/build/Test.ruleset b/build/Test.ruleset
new file mode 100644
index 0000000..0cac6ad
--- /dev/null
+++ b/build/Test.ruleset
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/stylecop.json b/build/stylecop.json
new file mode 100644
index 0000000..8f5c703
--- /dev/null
+++ b/build/stylecop.json
@@ -0,0 +1,14 @@
+{
+ "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
+ "settings": {
+ "documentationRules": {
+ "companyName": "Autofac Project",
+ "copyrightText": "Copyright (c) {companyName}. All rights reserved.\nLicensed under the {licenseName} License. See {licenseFile} in the project root for license information.",
+ "variables": {
+ "licenseFile": "LICENSE",
+ "licenseName": "MIT"
+ },
+ "xmlHeader": false
+ }
+ }
+}
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 0000000..e77200d
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,8 @@
+codecov:
+ branch: develop
+ require_ci_to_pass: yes
+coverage:
+ status:
+ project:
+ default:
+ threshold: 1%
diff --git a/global.json b/global.json
index b5c7160..4e61a93 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "3.1.401",
+ "version": "7.0.101",
"rollForward": "latestFeature"
}
}
\ No newline at end of file
diff --git a/src/Autofac.Integration.SignalR/Autofac.Integration.SignalR.csproj b/src/Autofac.Integration.SignalR/Autofac.Integration.SignalR.csproj
index f647665..9b86270 100644
--- a/src/Autofac.Integration.SignalR/Autofac.Integration.SignalR.csproj
+++ b/src/Autofac.Integration.SignalR/Autofac.Integration.SignalR.csproj
@@ -1,40 +1,69 @@
+
- true
- ..\..\Autofac.snk
- net472
- ..\..\..\
+
+ 0.0.1
+
+ Autofac.Integration.SignalR
Autofac.Integration.SignalR
- en-US
ASP.NET SignalR 2 Integration for Autofac
Copyright © 2014 Autofac Contributors
-
- 0.0.1
- bin\$(Configuration)\Autofac.Integration.SignalR.xml
- ..\..\Full.ruleset
- true
- Autofac ASP.NET SignalR 2 Integration
+ Autofac Contributors
+ Autofac
+ Autofac
+ ../../Autofac.snk
+ true
+ en-US
+
+ net472
+ latest
+ enable
+ true
+ ../../build/Analyzers.ruleset
+ true
+ AllEnabledByDefault
+ enable
+
Autofac.SignalR2
- https://autofac.org
- https://github.com/autofac/Autofac.SignalR
- github
- MIT
+ autofac;di;ioc;dependencyinjection
Release notes are at https://github.com/autofac/Autofac.SignalR/releases
icon.png
+ https://autofac.org
+ MIT
+ README.md
+ git
+ https://github.com/autofac/Autofac.SignalR
+ true
+ true
+ true
+ true
+ snupkg
+
+
+
+
+
-
- CodeAnalysisDictionary.xml
-
+
-
-
+
+
+
+ all
+
+
+ all
+
+
+ all
+
-
\ No newline at end of file
+
diff --git a/src/Autofac.Integration.SignalR/AutofacDependencyResolver.cs b/src/Autofac.Integration.SignalR/AutofacDependencyResolver.cs
index ec5595f..44a5cce 100644
--- a/src/Autofac.Integration.SignalR/AutofacDependencyResolver.cs
+++ b/src/Autofac.Integration.SignalR/AutofacDependencyResolver.cs
@@ -1,84 +1,56 @@
-// This software is part of the Autofac IoC container
-// Copyright © 2013 Autofac Contributors
-// https://autofac.org
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
+// Copyright (c) Autofac Project. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
-using System;
-using System.Collections.Generic;
-using System.Linq;
using Microsoft.AspNet.SignalR;
-namespace Autofac.Integration.SignalR
+namespace Autofac.Integration.SignalR;
+
+///
+/// Autofac implementation of the interface.
+///
+public class AutofacDependencyResolver : DefaultDependencyResolver
{
///
- /// Autofac implementation of the interface.
+ /// Initializes a new instance of the class.
///
- public class AutofacDependencyResolver : DefaultDependencyResolver
+ /// The lifetime scope that services will be resolved from.
+ ///
+ /// Thrown if is .
+ ///
+ public AutofacDependencyResolver(ILifetimeScope lifetimeScope)
{
- readonly ILifetimeScope _lifetimeScope;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The lifetime scope that services will be resolved from.
- ///
- /// Thrown if is .
- ///
- public AutofacDependencyResolver(ILifetimeScope lifetimeScope)
- {
- _lifetimeScope = lifetimeScope ?? throw new ArgumentNullException(nameof(lifetimeScope));
- }
+ LifetimeScope = lifetimeScope ?? throw new ArgumentNullException(nameof(lifetimeScope));
+ }
- ///
- /// Gets the Autofac implementation of the dependency resolver.
- ///
- public static AutofacDependencyResolver Current => GlobalHost.DependencyResolver as AutofacDependencyResolver;
+ ///
+ /// Gets the Autofac implementation of the dependency resolver.
+ ///
+ public static AutofacDependencyResolver? Current => GlobalHost.DependencyResolver as AutofacDependencyResolver;
- ///
- /// Gets the that was provided to the constructor.
- ///
- public ILifetimeScope LifetimeScope => _lifetimeScope;
+ ///
+ /// Gets the that was provided to the constructor.
+ ///
+ public ILifetimeScope LifetimeScope { get; }
- ///
- /// Get a single instance of a service.
- ///
- /// Type of the service.
- /// The single instance if resolved; otherwise, null.
- public override object GetService(Type serviceType)
- {
- return _lifetimeScope.ResolveOptional(serviceType) ?? base.GetService(serviceType);
- }
+ ///
+ /// Get a single instance of a service.
+ ///
+ /// Type of the service.
+ /// The single instance if resolved; otherwise, null.
+ public override object GetService(Type serviceType)
+ {
+ return LifetimeScope.ResolveOptional(serviceType) ?? base.GetService(serviceType);
+ }
- ///
- /// Gets all available instances of a services.
- ///
- /// Type of the service.
- /// The list of instances if any were resolved; otherwise, an empty list.
- public override IEnumerable