forked from abpframework/abp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Volo.Abp.Autofac.WebAssembly package, move ABP application …
…creation code to the framework.
- Loading branch information
Showing
13 changed files
with
166 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...icrosoft/AspNetCore/Components/WebAssembly/Hosting/AbpWebAssemblyHostBuilderExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using JetBrains.Annotations; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Volo.Abp; | ||
using Volo.Abp.AspNetCore.Components.WebAssembly; | ||
using Volo.Abp.Modularity; | ||
|
||
namespace Microsoft.AspNetCore.Components.WebAssembly.Hosting | ||
{ | ||
public static class AbpWebAssemblyHostBuilderExtensions | ||
{ | ||
public static IAbpApplicationWithExternalServiceProvider AddApplication<TStartupModule>( | ||
[NotNull] this WebAssemblyHostBuilder builder, | ||
Action<AbpWebAssemblyApplicationCreationOptions> options) | ||
where TStartupModule : IAbpModule | ||
{ | ||
Check.NotNull(builder, nameof(builder)); | ||
|
||
builder.Services.AddSingleton<IConfiguration>(builder.Configuration); | ||
builder.Services.AddSingleton(builder); | ||
|
||
var application = builder.Services.AddApplication<TStartupModule>(opts => | ||
{ | ||
options?.Invoke(new AbpWebAssemblyApplicationCreationOptions(builder, opts)); | ||
}); | ||
|
||
return application; | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...ly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpWebAssemblyApplicationCreationOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting; | ||
|
||
namespace Volo.Abp.AspNetCore.Components.WebAssembly | ||
{ | ||
public class AbpWebAssemblyApplicationCreationOptions | ||
{ | ||
public WebAssemblyHostBuilder HostBuilder { get; } | ||
|
||
public AbpApplicationCreationOptions ApplicationCreationOptions { get; } | ||
|
||
public AbpWebAssemblyApplicationCreationOptions( | ||
WebAssemblyHostBuilder hostBuilder, | ||
AbpApplicationCreationOptions applicationCreationOptions) | ||
{ | ||
HostBuilder = hostBuilder; | ||
ApplicationCreationOptions = applicationCreationOptions; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> | ||
<ConfigureAwait ContinueOnCapturedContext="false" /> | ||
</Weavers> |
30 changes: 30 additions & 0 deletions
30
framework/src/Volo.Abp.Autofac.WebAssembly/FodyWeavers.xsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> | ||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> | ||
<xs:element name="Weavers"> | ||
<xs:complexType> | ||
<xs:all> | ||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> | ||
<xs:complexType> | ||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> | ||
</xs:complexType> | ||
</xs:element> | ||
</xs:all> | ||
<xs:attribute name="VerifyAssembly" type="xs:boolean"> | ||
<xs:annotation> | ||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> | ||
</xs:annotation> | ||
</xs:attribute> | ||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> | ||
<xs:annotation> | ||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> | ||
</xs:annotation> | ||
</xs:attribute> | ||
<xs:attribute name="GenerateXsd" type="xs:boolean"> | ||
<xs:annotation> | ||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> | ||
</xs:annotation> | ||
</xs:attribute> | ||
</xs:complexType> | ||
</xs:element> | ||
</xs:schema> |
23 changes: 23 additions & 0 deletions
23
...mponents/WebAssembly/Hosting/AbpWebAssemblyApplicationCreationOptionsAutofacExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using Autofac; | ||
using JetBrains.Annotations; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Volo.Abp; | ||
using Volo.Abp.AspNetCore.Components.WebAssembly; | ||
|
||
namespace Microsoft.AspNetCore.Components.WebAssembly.Hosting | ||
{ | ||
public static class AbpWebAssemblyApplicationCreationOptionsAutofacExtensions | ||
{ | ||
public static void UseAutofac( | ||
[NotNull] this AbpWebAssemblyApplicationCreationOptions options, | ||
[CanBeNull] Action<ContainerBuilder> configure = null) | ||
{ | ||
options.HostBuilder.Services.AddAutofacServiceProviderFactory(); | ||
options.HostBuilder.ConfigureContainer( | ||
options.HostBuilder.Services.GetSingletonInstance<IServiceProviderFactory<ContainerBuilder>>(), | ||
configure | ||
); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
framework/src/Volo.Abp.Autofac.WebAssembly/Volo.Abp.Autofac.WebAssembly.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<Import Project="..\..\..\configureawait.props" /> | ||
<Import Project="..\..\..\common.props" /> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.1</TargetFramework> | ||
<RootNamespace /> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Volo.Abp.AspNetCore.Components.WebAssembly\Volo.Abp.AspNetCore.Components.WebAssembly.csproj" /> | ||
<ProjectReference Include="..\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
14 changes: 14 additions & 0 deletions
14
.../Volo.Abp.Autofac.WebAssembly/Volo/Abp/Autofac/WebAssembly/AbpAutofacWebAssemblyModule.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Volo.Abp.AspNetCore.Components.WebAssembly; | ||
using Volo.Abp.Modularity; | ||
|
||
namespace Volo.Abp.Autofac.WebAssembly | ||
{ | ||
[DependsOn( | ||
typeof(AbpAutofacModule), | ||
typeof(AbpAspNetCoreComponentsWebAssemblyModule) | ||
)] | ||
public class AbpAutofacWebAssemblyModule : AbpModule | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters