Skip to content

Commit

Permalink
Merge pull request #51 from autofac/feature/autofac-8
Browse files Browse the repository at this point in the history
Update to Autofac 8; add .NET 8 support; drop .NET 3.1
  • Loading branch information
tillig authored Mar 12, 2024
2 parents 3f32a8f + 5e8dc65 commit bf9604f
Show file tree
Hide file tree
Showing 37 changed files with 289 additions and 346 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,5 @@ $RECYCLE.BIN/
# Mac crap
.DS_Store

# Rider crap
# JetBrains Rider
.idea
3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"recommendations": [
"davidanson.vscode-markdownlint",
"editorconfig.editorconfig",
"formulahendry.dotnet-test-explorer",
"ms-dotnettools.csharp",
"ms-dotnettools.csdevkit",
"stkb.rewrap"
]
}
20 changes: 2 additions & 18 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,9 @@
"launchBrowser": {
"enabled": false
},
"name": "Sandbox 2-3.1",
"name": "Sandbox 6",
"preLaunchTask": "build",
"program": "${workspaceFolder}/samples/Sandbox.AspNetCore3_To_3_1/bin/Debug/netcoreapp3.1/Sandbox.AspNetCore3_To_3_1.dll",
"request": "launch",
"stopAtEntry": false,
"type": "coreclr"
},
{
"cwd": "${workspaceFolder}",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "http://localhost:5555"
},
"launchBrowser": {
"enabled": false
},
"name": "Sandbox 5-6",
"preLaunchTask": "build",
"program": "${workspaceFolder}/samples/Sandbox.AspNetCore5_To_6/bin/Debug/net6.0/Sandbox.AspNetCore5_To_6.dll",
"program": "${workspaceFolder}/samples/Sandbox.AspNetCore6/bin/Debug/net6.0/Sandbox.AspNetCore6.dll",
"request": "launch",
"stopAtEntry": false,
"type": "coreclr"
Expand Down
9 changes: 1 addition & 8 deletions Autofac.AspNetCore.Multitenant.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
codecov.yml = codecov.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox.AspNetCore3_To_3_1", "samples\Sandbox.AspNetCore3_To_3_1\Sandbox.AspNetCore3_To_3_1.csproj", "{12445470-D348-467F-8D3F-FBD6EF525CEE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{8C9BBEEC-0C4B-4ECD-B927-63899C265FB4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{5227B99C-6D0F-4E7B-9DF8-82C53488E173}"
Expand All @@ -39,7 +37,7 @@ ProjectSection(SolutionItems) = preProject
build\stylecop.json = build\stylecop.json
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox.AspNetCore5_To_7", "samples\Sandbox.AspNetCore5_To_7\Sandbox.AspNetCore5_To_7.csproj", "{B64B6D62-AD07-49BE-AF65-3E4C92284AD5}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox.AspNetCore6", "samples\Sandbox.AspNetCore6\Sandbox.AspNetCore6.csproj", "{B64B6D62-AD07-49BE-AF65-3E4C92284AD5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -55,10 +53,6 @@ Global
{BA923A91-3A4B-40CE-8788-70A641694945}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA923A91-3A4B-40CE-8788-70A641694945}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA923A91-3A4B-40CE-8788-70A641694945}.Release|Any CPU.Build.0 = Release|Any CPU
{12445470-D348-467F-8D3F-FBD6EF525CEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12445470-D348-467F-8D3F-FBD6EF525CEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12445470-D348-467F-8D3F-FBD6EF525CEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{12445470-D348-467F-8D3F-FBD6EF525CEE}.Release|Any CPU.Build.0 = Release|Any CPU
{C1C581D6-57C2-4448-BF83-59C39CED7ABC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C1C581D6-57C2-4448-BF83-59C39CED7ABC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C1C581D6-57C2-4448-BF83-59C39CED7ABC}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -74,7 +68,6 @@ Global
GlobalSection(NestedProjects) = preSolution
{241CD558-86C8-493B-9FA1-D913167D527C} = {8C9BBEEC-0C4B-4ECD-B927-63899C265FB4}
{BA923A91-3A4B-40CE-8788-70A641694945} = {5227B99C-6D0F-4E7B-9DF8-82C53488E173}
{12445470-D348-467F-8D3F-FBD6EF525CEE} = {BD3275CD-8B4C-4CEA-8DDB-BEF386DD48B5}
{C1C581D6-57C2-4448-BF83-59C39CED7ABC} = {BD3275CD-8B4C-4CEA-8DDB-BEF386DD48B5}
{B64B6D62-AD07-49BE-AF65-3E4C92284AD5} = {BD3275CD-8B4C-4CEA-8DDB-BEF386DD48B5}
EndGlobalSection
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: 7.0.0.{build}
version: 8.0.0.{build}

dotnet_csproj:
version_prefix: "7.0.0"
version_prefix: "8.0.0"
patch: true
file: 'src\**\*.csproj'

Expand Down
8 changes: 3 additions & 5 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"sdk": {
"version": "7.0.203",
"version": "8.0.101",
"rollForward": "latestFeature"
},

"additionalSdks": [
"6.0.300",
"5.0.403",
"3.1.302"
"6.0.418",
"7.0.405"
]
}
23 changes: 0 additions & 23 deletions samples/Sandbox.AspNetCore3_To_3_1/Program.cs

This file was deleted.

8 changes: 0 additions & 8 deletions samples/Sandbox.AspNetCore3_To_3_1/Properties/AssemblyInfo.cs

This file was deleted.

14 changes: 0 additions & 14 deletions samples/Sandbox.AspNetCore3_To_3_1/Properties/launchSettings.json

This file was deleted.

This file was deleted.

33 changes: 0 additions & 33 deletions samples/Sandbox.AspNetCore3_To_3_1/Startup.cs

This file was deleted.

10 changes: 0 additions & 10 deletions samples/Sandbox.AspNetCore3_To_3_1/appsettings.Development.json

This file was deleted.

8 changes: 0 additions & 8 deletions samples/Sandbox.AspNetCore3_To_3_1/appsettings.json

This file was deleted.

17 changes: 0 additions & 17 deletions samples/Sandbox.AspNetCore5_To_7/Program.cs

This file was deleted.

28 changes: 0 additions & 28 deletions samples/Sandbox.AspNetCore5_To_7/Startup.cs

This file was deleted.

32 changes: 32 additions & 0 deletions samples/Sandbox.AspNetCore6/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) Autofac Project. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

namespace Sandbox;

/// <summary>
/// Entry pont for the ASP.NET sandbox application.
/// </summary>
public static class Program
{
/// <summary>
/// Primary method for execution of the sandbox application.
/// </summary>
/// <param name="args">
/// The set of command line arguments provided to the application.
/// </param>
/// <returns>
/// A <see cref="Task"/> to await completion of the host execution.
/// </returns>
public static async Task Main(string[] args)
{
// Note the AutofacMultitenantServiceProviderFactory takes the method
// that configures the tenant-specific overrides. That doesn't show up
// in your Startup class.
var host = Host.CreateDefaultBuilder(args)
.UseServiceProviderFactory(new AutofacMultitenantServiceProviderFactory(ContainerSetup.ConfigureMultitenantContainer))
.ConfigureWebHostDefaults(webHostBuilder => webHostBuilder.UseStartup<Startup>())
.Build();

await host.RunAsync();
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Sandbox</RootNamespace>
<NoWarn>$(NoWarn);CA1707;CA1848;CS1591;SA1600</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<CodeAnalysisRuleSet>../../build/Analyzers.ruleset</CodeAnalysisRuleSet>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
Expand All @@ -14,8 +14,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435">
<PrivateAssets>All</PrivateAssets>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

Expand Down
51 changes: 51 additions & 0 deletions samples/Sandbox.AspNetCore6/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright (c) Autofac Project. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using Autofac;

namespace Sandbox;

/// <summary>
/// Startup logic for the sandbox application.
/// </summary>
public class Startup
{
/// <summary>
/// Configures default services using the standard Microsoft container.
/// </summary>
/// <param name="services">
/// The <see cref="IServiceCollection"/> into which registrations will be made.
/// </param>
public void ConfigureServices(IServiceCollection services)
{
services
.AddAutofacMultitenantRequestServices()
.AddControllers();
}

/// <summary>
/// Configures default services that override standard Microsoft services. This method is called after <see cref="ConfigureServices"/> but before multitenant overrides occur.
/// </summary>
/// <param name="builder">
/// The Autofac <see cref="ContainerBuilder"/> into which default registrations will occur.
/// </param>
public void ConfigureContainer(ContainerBuilder builder)
{
// Note the multitenant registrations aren't here! They're in
// Program.cs, and they're passed into the
// AutofacMultitenantServiceProviderFactory.
ContainerSetup.ConfigureContainer(builder);
}

/// <summary>
/// Configures the pipeline for the sandbox application.
/// </summary>
/// <param name="app">
/// The <see cref="IApplicationBuilder"/> with which the pipeline is being built.
/// </param>
public void Configure(IApplicationBuilder app)
{
app.UseRouting();
app.UseEndpoints(builder => builder.MapControllers());
}
}
Loading

0 comments on commit bf9604f

Please sign in to comment.