mirror of https://github.com/abpframework/abp.git
committed by
GitHub
5 changed files with 64 additions and 15 deletions
@ -0,0 +1,18 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using Microsoft.Extensions.Hosting; |
|||
|
|||
namespace Microsoft.Extensions.Configuration; |
|||
|
|||
public static class AbpConfigurationExtensions |
|||
{ |
|||
public static IConfigurationBuilder AddAppSettingsSecretsJson( |
|||
this IConfigurationBuilder builder, |
|||
bool optional = true, |
|||
bool reloadOnChange = true, |
|||
string path = AbpHostingHostBuilderExtensions.AppSettingsSecretJsonPath) |
|||
{ |
|||
return builder.AddJsonFile(path: path, optional: optional, reloadOnChange: reloadOnChange); |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Threading; |
|||
|
|||
namespace Microsoft.Extensions.Hosting; |
|||
|
|||
public static class AbpHostExtensions |
|||
{ |
|||
public static async Task InitializeAsync(this IHost host) |
|||
{ |
|||
var application = host.Services.GetRequiredService<IAbpApplicationWithExternalServiceProvider>(); |
|||
var applicationLifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); |
|||
|
|||
applicationLifetime.ApplicationStopping.Register(() => AsyncHelper.RunSync(() => application.ShutdownAsync())); |
|||
applicationLifetime.ApplicationStopped.Register(() => application.Dispose()); |
|||
|
|||
await application.InitializeAsync(host.Services); |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
{ |
|||
"profiles": { |
|||
"MyCompanyName.MyProjectName": { |
|||
"commandName": "Project", |
|||
"environmentVariables": { |
|||
"DOTNET_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue