Browse Source
Set `ApplicationName` as current `assembly name`.
pull/17497/head
maliming
3 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
4 changed files with
6 additions and
25 deletions
-
framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/WebApplicationBuilderExtensions.cs
-
framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs
-
framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/AbpSerilogTestModule.cs
-
framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/AbpHttpClientTestModule.cs
|
|
|
@ -12,6 +12,12 @@ public static class WebApplicationBuilderExtensions |
|
|
|
public async static Task RunAbpModuleAsync<TModule>(this WebApplicationBuilder builder, Action<AbpApplicationCreationOptions>? optionsAction = null) |
|
|
|
where TModule : IAbpModule |
|
|
|
{ |
|
|
|
var assemblyName = typeof(TModule).Assembly.GetName()?.Name; |
|
|
|
if (!assemblyName.IsNullOrWhiteSpace()) |
|
|
|
{ |
|
|
|
// Set the application name as the assembly name of the module will automatically add assembly to the ApplicationParts of MVC application.
|
|
|
|
builder.Environment.ApplicationName = assemblyName!; |
|
|
|
} |
|
|
|
builder.Host.UseAutofac(); |
|
|
|
await builder.AddApplicationAsync<TModule>(optionsAction); |
|
|
|
var app = builder.Build(); |
|
|
|
|
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic; |
|
|
|
using System.Security.Claims; |
|
|
|
using Localization.Resources.AbpUi; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.Mvc.ApplicationParts; |
|
|
|
using Microsoft.AspNetCore.Mvc.Razor; |
|
|
|
using Microsoft.AspNetCore.Mvc.RazorPages; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
@ -38,12 +37,6 @@ public class AbpAspNetCoreMvcTestModule : AbpModule |
|
|
|
|
|
|
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
PreConfigure<IMvcBuilder>(mvcBuilder => |
|
|
|
{ |
|
|
|
mvcBuilder.PartManager.ApplicationParts.Add(new AssemblyPart(typeof(AbpAspNetCoreMvcTestModule).Assembly)); |
|
|
|
mvcBuilder.PartManager.ApplicationParts.Add(new CompiledRazorAssemblyPart(typeof(AbpAspNetCoreMvcTestModule).Assembly)); |
|
|
|
}); |
|
|
|
|
|
|
|
context.Services.PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options => |
|
|
|
{ |
|
|
|
options.AddAssemblyResource( |
|
|
|
|
|
|
|
@ -1,5 +1,4 @@ |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Volo.Abp.AspNetCore.MultiTenancy; |
|
|
|
using Volo.Abp.AspNetCore.Mvc; |
|
|
|
using Volo.Abp.AspNetCore.Serilog; |
|
|
|
@ -19,14 +18,6 @@ namespace Volo.Abp.AspNetCore.App; |
|
|
|
)] |
|
|
|
public class AbpSerilogTestModule : AbpModule |
|
|
|
{ |
|
|
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
PreConfigure<IMvcBuilder>(mvcBuilder => |
|
|
|
{ |
|
|
|
mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpSerilogTestModule).Assembly); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
Configure<AbpMultiTenancyOptions>(options => { options.IsEnabled = true; }); |
|
|
|
|
|
|
|
@ -1,7 +1,6 @@ |
|
|
|
using System.Collections.Generic; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Volo.Abp.AspNetCore.Mvc; |
|
|
|
using Volo.Abp.AspNetCore.Mvc.Conventions; |
|
|
|
using Volo.Abp.Http.Client; |
|
|
|
using Volo.Abp.Http.Client.ClientProxying; |
|
|
|
using Volo.Abp.Http.DynamicProxying; |
|
|
|
@ -21,14 +20,6 @@ namespace Volo.Abp.Http; |
|
|
|
)] |
|
|
|
public class AbpHttpClientTestModule : AbpModule |
|
|
|
{ |
|
|
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
PreConfigure<IMvcBuilder>(mvcBuilder => |
|
|
|
{ |
|
|
|
mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpHttpClientTestModule).Assembly); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
context.Services.AddHttpClientProxies(typeof(TestAppModule).Assembly); |
|
|
|
|