Skip to content

Commit

Permalink
Bump autofac version to 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nivalxer committed Mar 27, 2024
1 parent ad7004e commit 14183a0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


<ItemGroup>
<PackageReference Include="Autofac" Version="[7.0.0, 8.0.0)" />
<PackageReference Include="Autofac" Version="[8.0.0, 9.0.0)" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 12 additions & 2 deletions src/AspectCore.Extensions.Autofac/AutofacServiceResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using AspectCore.DynamicProxy;
using AspectCore.DependencyInjection;
using Autofac;
using Autofac.Core;
using Autofac.Core.Lifetime;

namespace AspectCore.Extensions.Autofac
{
Expand Down Expand Up @@ -34,12 +36,20 @@ public object Resolve(Type serviceType)
#if NET8_0_OR_GREATER
public object GetKeyedService(Type serviceType, object serviceKey)
{
throw new NotImplementedException();
if (serviceKey is null)
{
return _componentContext.ResolveOptional(serviceType);
}
return _componentContext.ResolveKeyed(serviceKey, serviceType);
}

public object GetRequiredKeyedService(Type serviceType, object serviceKey)
{
throw new NotImplementedException();
if (serviceKey is null)
{
return _componentContext.Resolve(serviceType);
}
return _componentContext.ResolveKeyed(serviceKey, serviceType);
}
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Specification.Tests" Version="6.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Specification.Tests" Version="8.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Specification.Tests" Version="7.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Specification.Tests" Version="8.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Specification.Tests" Version="8.0.0" />
</ItemGroup>

Expand Down

0 comments on commit 14183a0

Please sign in to comment.