maliming
4 years ago
No known key found for this signature in database
GPG Key ID: 96224957E51C89E
2 changed files with
13 additions and
4 deletions
-
framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacRegistration.cs
-
framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj
|
|
|
@ -94,13 +94,22 @@ public static class AutofacRegistration |
|
|
|
throw new ArgumentNullException(nameof(services)); |
|
|
|
} |
|
|
|
|
|
|
|
builder.RegisterType<AutofacServiceProvider>().As<IServiceProvider>().ExternallyOwned(); |
|
|
|
builder.RegisterType<AutofacServiceProvider>() |
|
|
|
.As<IServiceProvider>() |
|
|
|
.As<IServiceProviderIsService>() |
|
|
|
.ExternallyOwned(); |
|
|
|
|
|
|
|
var autofacServiceScopeFactory = typeof(AutofacServiceProvider).Assembly.GetType("Autofac.Extensions.DependencyInjection.AutofacServiceScopeFactory"); |
|
|
|
if (autofacServiceScopeFactory == null) |
|
|
|
{ |
|
|
|
throw new AbpException("Unable get type of Autofac.Extensions.DependencyInjection.AutofacServiceScopeFactory!"); |
|
|
|
} |
|
|
|
builder.RegisterType(autofacServiceScopeFactory).As<IServiceScopeFactory>(); |
|
|
|
|
|
|
|
// Issue #83: IServiceScopeFactory must be a singleton and scopes must be flat, not hierarchical.
|
|
|
|
builder |
|
|
|
.RegisterType(autofacServiceScopeFactory) |
|
|
|
.As<IServiceScopeFactory>() |
|
|
|
.SingleInstance(); |
|
|
|
|
|
|
|
Register(builder, services, lifetimeScopeTagForSingletons); |
|
|
|
} |
|
|
|
|
|
|
|
@ -15,8 +15,8 @@ |
|
|
|
</PropertyGroup> |
|
|
|
|
|
|
|
<ItemGroup> |
|
|
|
<PackageReference Include="Autofac" Version="6.3.0" /> |
|
|
|
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" /> |
|
|
|
<PackageReference Include="Autofac" Version="6.4.0" /> |
|
|
|
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" /> |
|
|
|
<PackageReference Include="Autofac.Extras.DynamicProxy" Version="6.0.1" /> |
|
|
|
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftPackageVersion)" /> |
|
|
|
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(MicrosoftPackageVersion)" /> |
|
|
|
|