Skip to content

Commit 14183a0

Browse files
committed
Bump autofac version to 8.0
1 parent ad7004e commit 14183a0

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

src/AspectCore.Extensions.Autofac/AspectCore.Extensions.Autofac.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
<ItemGroup>
24-
<PackageReference Include="Autofac" Version="[7.0.0, 8.0.0)" />
24+
<PackageReference Include="Autofac" Version="[8.0.0, 9.0.0)" />
2525
</ItemGroup>
2626

2727
<ItemGroup>

src/AspectCore.Extensions.Autofac/AutofacServiceResolver.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
using AspectCore.DynamicProxy;
33
using AspectCore.DependencyInjection;
44
using Autofac;
5+
using Autofac.Core;
6+
using Autofac.Core.Lifetime;
57

68
namespace AspectCore.Extensions.Autofac
79
{
@@ -34,12 +36,20 @@ public object Resolve(Type serviceType)
3436
#if NET8_0_OR_GREATER
3537
public object GetKeyedService(Type serviceType, object serviceKey)
3638
{
37-
throw new NotImplementedException();
39+
if (serviceKey is null)
40+
{
41+
return _componentContext.ResolveOptional(serviceType);
42+
}
43+
return _componentContext.ResolveKeyed(serviceKey, serviceType);
3844
}
3945

4046
public object GetRequiredKeyedService(Type serviceType, object serviceKey)
4147
{
42-
throw new NotImplementedException();
48+
if (serviceKey is null)
49+
{
50+
return _componentContext.Resolve(serviceType);
51+
}
52+
return _componentContext.ResolveKeyed(serviceKey, serviceType);
4353
}
4454
#endif
4555
}

tests/AspectCore.Extensions.Autofac.Test/AspectCore.Extensions.Autofac.Test.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
</ItemGroup>
1919

2020
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
21-
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
22-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Specification.Tests" Version="6.0.0" />
21+
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" />
22+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Specification.Tests" Version="8.0.0" />
2323
</ItemGroup>
2424

2525
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
26-
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
27-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Specification.Tests" Version="7.0.0" />
26+
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" />
27+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Specification.Tests" Version="8.0.0" />
2828
</ItemGroup>
2929

3030
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
31-
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
31+
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" />
3232
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Specification.Tests" Version="8.0.0" />
3333
</ItemGroup>
3434

0 commit comments

Comments
 (0)