Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Autofac.AspNetCore.Multitenant.sln
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ProjectSection(SolutionItems) = preProject
build\stylecop.json = build\stylecop.json
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox.AspNetCore5", "samples\Sandbox.AspNetCore5\Sandbox.AspNetCore5.csproj", "{B64B6D62-AD07-49BE-AF65-3E4C92284AD5}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox.AspNetCore5_To_6", "samples\Sandbox.AspNetCore5_To_6\Sandbox.AspNetCore5_To_6.csproj", "{B64B6D62-AD07-49BE-AF65-3E4C92284AD5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
image: Ubuntu

version: 5.0.0.{build}
version: 5.1.0.{build}

dotnet_csproj:
version_prefix: '5.0.0'
version_prefix: '5.1.0'
patch: true
file: 'src\**\*.csproj'

Expand Down
32 changes: 10 additions & 22 deletions build/Autofac.Build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,6 @@ function Install-DotNetCli {
[string]
$Version = "Latest"
)

if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue)) {
$installedVersions = dotnet --list-sdks
foreach ($sdkListLine in $installedVersions)
{
$splitParts = $sdkListLine.Split(" ");

$versionPart = $splitParts[0];

$globalInstallLocation = $splitParts[1].Replace("[", "").Replace("]", "")

if ($versionPart -eq $Version)
{
Write-Message ".NET Core SDK version $Version is already installed in $globalInstallLocation"
Add-Path "$globalInstallLocation"
return;
}
}
}

Write-Message "Installing .NET SDK version $Version"

$callerPath = Split-Path $MyInvocation.PSCommandPath
Expand Down Expand Up @@ -93,11 +73,19 @@ function Add-Path {
[string]
$Path
)
$pathValues = $env:PATH.Split(";");

$pathSeparator = ":";

if ($IsWindows) {
$pathSeparator = ";";
}

$pathValues = $env:PATH.Split($pathSeparator);
if ($pathValues -Contains $Path) {
return;
}
$env:PATH = "$Path;$env:PATH"

$env:PATH = "${Path}${pathSeparator}$env:PATH"
}

<#
Expand Down
3 changes: 2 additions & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"sdk": {
"version": "5.0.100",
"version": "6.0.100",
"rollForward": "latestFeature"
},

"additionalSdks": [
"5.0.403",
"2.1.811",
"3.1.302"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Sandbox</RootNamespace>
<NoWarn>$(NoWarn);CS1591;SA1600</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Description>ASP.NET Core support for multitenant DI via Autofac.Multitenant.</Description>
<!-- VersionPrefix patched by AppVeyor -->
<VersionPrefix>0.0.1</VersionPrefix>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Autofac.Integration.AspNetCore.Multitenant</AssemblyName>
Expand Down Expand Up @@ -47,7 +47,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
<PackageReference Include="Autofac.Multitenant" Version="6.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="2.6.1">
<PrivateAssets>All</PrivateAssets>
Expand All @@ -58,7 +58,7 @@
<PackageReference Include="Microsoft.Net.RoslynDiagnostics" Version="2.6.1">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" Condition="Exists('$(MSBuildThisFileDirectory)../../.git')">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" Condition="Exists('$(MSBuildThisFileDirectory)../../.git')">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using Autofac;
using Autofac.Integration.AspNetCore.Multitenant;
using Autofac.Multitenant;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using System.Collections.Generic;
using System.Reflection;
using Autofac;
using Autofac.Builder;
using Autofac.Extensions.DependencyInjection;
using Autofac.Integration.AspNetCore.Multitenant;
using Autofac.Integration.AspNetCore.Multitenant.Properties;
using Autofac.Multitenant;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.AspNetCore.Hosting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using Autofac;
using Autofac.Multitenant;

namespace Microsoft.AspNetCore.Hosting
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ public async Task Invoke(HttpContext context)
{
var autofacFeature = RequestServicesFeatureFactory.CreateFeature(context, _multitenantContainer.Resolve<IServiceScopeFactory>());

if (autofacFeature is IDisposable disp)
if (autofacFeature is IDisposable disposable)
{
context.Response.RegisterForDispose(disp);
context.Response.RegisterForDispose(disposable);
}

existingFeature = context.Features.Get<IServiceProvidersFeature>();
#pragma warning disable SA1009
existingFeature = context.Features.Get<IServiceProvidersFeature>()!;
#pragma warning restore
context.Features.Set(autofacFeature);

await _next.Invoke(context);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<!-- netcoreapp2.1 is out of support, we don't need a warning about it. -->
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<NoWarn>$(NoWarn);CS1591;SA1600</NoWarn>
Expand All @@ -28,8 +28,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="Moq" Version="4.15.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand All @@ -38,8 +38,20 @@
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="coverlet.collector" Version="1.3.0" />
<PackageReference Include="coverlet.msbuild" Version="2.9.0" />
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) == 'net6.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) == 'net5.0'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using Autofac.Integration.AspNetCore.Multitenant.Properties;
using Autofac.Multitenant;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using Xunit;

namespace Autofac.Integration.AspNetCore.Multitenant.Test
Expand Down Expand Up @@ -43,7 +40,6 @@ public void AddAutofacMultitenantRequestServices_AddsStartupFilter()
[Fact]
public void AddAutofacMultitenantRequestServices_NullBuilder()
{
var mtc = new MultitenantContainer(Mock.Of<ITenantIdentificationStrategy>(), new ContainerBuilder().Build());
Assert.Throws<ArgumentNullException>(() => AutofacMultitenantServiceCollectionExtensions.AddAutofacMultitenantRequestServices(null!));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using Autofac.Multitenant;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -52,7 +51,6 @@ public void UseAutofacMultitenantRequestServices_AddsStartupFilter()
[Fact]
public void UseAutofacMultitenantRequestServices_NullBuilder()
{
var mtc = new MultitenantContainer(Mock.Of<ITenantIdentificationStrategy>(), new ContainerBuilder().Build());
Assert.Throws<ArgumentNullException>(() => AutofacMultitenantWebHostBuilderExtensions.UseAutofacMultitenantRequestServices(null!));
}
}
Expand Down