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
3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
"bierner.markdown-emoji",
"davidanson.vscode-markdownlint",
"editorconfig.editorconfig",
"formulahendry.dotnet-test-explorer",
"gruntfuggly.todo-tree",
"ms-dotnettools.csharp",
"ms-dotnettools.csdevkit",
"ryanluker.vscode-coverage-gutters",
"stkb.rewrap",
"travisillig.vscode-json-stable-stringify"
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: '8.0.1.{build}'
version: '8.0.2.{build}'

dotnet_csproj:
version_prefix: '8.0.1'
version_prefix: '8.0.2'
patch: true
file: 'src\**\*.csproj'

Expand Down
2 changes: 1 addition & 1 deletion src/Autofac.Multitenant/ITenantIdentificationStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ public interface ITenantIdentificationStrategy
/// if not.
/// </returns>
[SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate", Justification = "Tenant identifiers are objects.")]
bool TryIdentifyTenant(out object tenantId);
bool TryIdentifyTenant(out object? tenantId);
}
2 changes: 1 addition & 1 deletion src/Autofac.Multitenant/MultitenantContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public ILifetimeScope BeginLoadContextLifetimeScope(object tag, AssemblyLoadCont
/// </exception>
/// <seealso cref="ConfigurationActionBuilder"/>
/// <seealso cref="ReconfigureTenant(object, Action{ContainerBuilder})"/>
public void ConfigureTenant(object tenantId, Action<ContainerBuilder> configuration)
public void ConfigureTenant(object? tenantId, Action<ContainerBuilder> configuration)
{
if (configuration == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public static class TenantIdentificationStrategyExtensions
throw new ArgumentNullException(nameof(strategy));
}

if (strategy.TryIdentifyTenant(out object id))
if (strategy.TryIdentifyTenant(out var id))
{
return (T)id;
return (T?)id;
}

return default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<LangVersion>latest</LangVersion>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand All @@ -29,22 +30,22 @@

<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
<PackageReference Include="coverlet.msbuild" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public StubTenantIdentificationStrategy()

public bool IdentificationSuccess { get; set; }

public object TenantId { get; set; }
public object? TenantId { get; set; }

public bool TryIdentifyTenant(out object tenantId)
public bool TryIdentifyTenant(out object? tenantId)
{
tenantId = TenantId;
return IdentificationSuccess;
Expand Down
11 changes: 6 additions & 5 deletions test/Autofac.Multitenant.Test/Autofac.Multitenant.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<LangVersion>latest</LangVersion>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand All @@ -28,21 +29,21 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
<PackageReference Include="coverlet.msbuild" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
8 changes: 4 additions & 4 deletions test/Autofac.Multitenant.Test/MultitenantContainerFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void ConfigureTenant_RequiresConfiguration()
TenantId = "tenant1",
};
using var mtc = new MultitenantContainer(strategy, builder.Build());
Assert.Throws<ArgumentNullException>(() => mtc.ConfigureTenant("tenant1", null));
Assert.Throws<ArgumentNullException>(() => mtc.ConfigureTenant("tenant1", null!));
}

[Fact]
Expand All @@ -142,13 +142,13 @@ public void ConfigureTenant_ThrowsAfterDisposal()
[Fact]
public void Ctor_NullApplicationContainer()
{
Assert.Throws<ArgumentNullException>(() => new MultitenantContainer(new StubTenantIdentificationStrategy(), null));
Assert.Throws<ArgumentNullException>(() => new MultitenantContainer(new StubTenantIdentificationStrategy(), null!));
}

[Fact]
public void Ctor_NullTenantIdentificationStrategy()
{
Assert.Throws<ArgumentNullException>(() => new MultitenantContainer(null, new ContainerBuilder().Build()));
Assert.Throws<ArgumentNullException>(() => new MultitenantContainer(null!, new ContainerBuilder().Build()));
}

[Fact]
Expand Down Expand Up @@ -578,7 +578,7 @@ public void ReconfigureTenant_RequiresConfiguration()
using var mtc = new MultitenantContainer(strategy, builder.Build());
mtc.ConfigureTenant("tenant1", b => b.RegisterType<StubDependency1Impl2>().AsImplementedInterfaces().SingleInstance());

Assert.Throws<ArgumentNullException>(() => mtc.ReconfigureTenant("tenant1", null));
Assert.Throws<ArgumentNullException>(() => mtc.ReconfigureTenant("tenant1", null!));
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class RegistrationExtensionsFixture
[Fact]
public void InstancePerTenant_NullRegistration()
{
IRegistrationBuilder<StubDependency1Impl1, ConcreteReflectionActivatorData, SingleRegistrationStyle> registration = null;
IRegistrationBuilder<StubDependency1Impl1, ConcreteReflectionActivatorData, SingleRegistrationStyle> registration = null!;
Assert.Throws<ArgumentNullException>(() => registration.InstancePerTenant());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public StubTenantIdentificationStrategy()

public bool IdentificationSuccess { get; set; }

public object TenantId { get; set; }
public object? TenantId { get; set; }

public bool TryIdentifyTenant(out object tenantId)
public bool TryIdentifyTenant(out object? tenantId)
{
tenantId = TenantId;
return IdentificationSuccess;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void IdentifyTenant_FailedRetrieval()
[Fact]
public void IdentifyTenant_NullStrategy()
{
ITenantIdentificationStrategy strategy = null;
ITenantIdentificationStrategy strategy = null!;
Assert.Throws<ArgumentNullException>(() => strategy.IdentifyTenant<Guid>());
}

Expand Down