From 8d5742d1591e484fd24e45e592b425a47610e91b Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Wed, 20 May 2020 16:35:17 +0800 Subject: [PATCH 01/48] Optimize RazorRuntimeCompilation. --- ....Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj | 2 - ...o.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj | 8 +-- ...AspNetCore.Mvc.UI.Theme.Shared.Demo.csproj | 5 -- ....Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj | 6 -- .../Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj | 5 -- .../Volo.Abp.AspNetCore.Mvc.UI.csproj | 5 -- .../AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs | 19 ++++-- .../AbpRazorCompiledItemFeatureProvider.cs | 62 +++++++++++++++++++ ...Volo.Abp.Account.Web.IdentityServer.csproj | 2 - .../Volo.Abp.Account.Web.csproj | 6 +- .../Volo.Blogging.Web.csproj | 2 - .../Volo.ClientSimulation.Web.csproj | 2 - .../Volo.Docs.Admin.Web.csproj | 2 - .../src/Volo.Docs.Web/Volo.Docs.Web.csproj | 6 +- .../Volo.Abp.FeatureManagement.Web.csproj | 2 - .../Volo.Abp.Identity.Web.csproj | 2 - .../Volo.Abp.PermissionManagement.Web.csproj | 2 - .../Volo.Abp.SettingManagement.Web.csproj | 2 - .../Volo.Abp.TenantManagement.Web.csproj | 2 - .../ProductManagement.Web.csproj | 2 - .../MyCompanyName.MyProjectName.Web.csproj | 2 - 21 files changed, 81 insertions(+), 65 deletions(-) create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ViewFeatures/AbpRazorCompiledItemFeatureProvider.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj index 2400b9c291..906f4fc2c9 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj @@ -18,10 +18,8 @@ - - diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj index 43f5bc20bf..c390cfe58c 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj @@ -17,17 +17,11 @@ - - - - - - @@ -36,5 +30,5 @@ - + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.csproj index 66015b14a7..078563ace3 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.csproj @@ -17,11 +17,6 @@ - - - - - diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj index 7c4147bba5..71e1257a4d 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj @@ -18,16 +18,10 @@ - - - - - - diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj index 06afcf3f3e..9d0f384611 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj @@ -17,9 +17,4 @@ - - - - - diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj index ffdaf02d94..d14d639fbb 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj @@ -14,11 +14,6 @@ - - - - - diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs index ee81e0a22e..775f7ee704 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs @@ -16,6 +16,7 @@ using System.Reflection; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.AspNetCore.Mvc.Razor; +using Microsoft.AspNetCore.Mvc.Razor.Compilation; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure; using Microsoft.AspNetCore.Routing; @@ -27,6 +28,7 @@ using Volo.Abp.AspNetCore.Mvc.Conventions; using Volo.Abp.AspNetCore.Mvc.DependencyInjection; using Volo.Abp.AspNetCore.Mvc.Json; using Volo.Abp.AspNetCore.Mvc.Localization; +using Volo.Abp.AspNetCore.Mvc.ViewFeatures; using Volo.Abp.AspNetCore.VirtualFileSystem; using Volo.Abp.DependencyInjection; using Volo.Abp.Http; @@ -75,14 +77,14 @@ namespace Volo.Abp.AspNetCore.Mvc (int) HttpStatusCode.NotImplemented, (int) HttpStatusCode.InternalServerError }; - + options.SupportedResponseTypes.AddIfNotContains(statusCodes.Select(statusCode => new ApiResponseType { Type = typeof(RemoteServiceErrorResponse), StatusCode = statusCode })); }); - + context.Services.PostConfigure(options => { if (options.MinifyGeneratedScript == null) @@ -126,10 +128,10 @@ namespace Volo.Abp.AspNetCore.Mvc return factory.Create(resourceType); } - return factory.CreateDefaultOrNull() ?? + return factory.CreateDefaultOrNull() ?? factory.Create(type); }; - }) + }) .AddViewLocalization(); //TODO: How to configure from the application? Also, consider to move to a UI module since APIs does not care about it. Configure(options => @@ -161,6 +163,15 @@ namespace Volo.Abp.AspNetCore.Mvc var application = context.Services.GetSingletonInstance(); partManager.FeatureProviders.Add(new AbpConventionalControllerFeatureProvider(application)); + + //Replace the built-in RazorCompiledItemFeatureProvider in ASP NET Core. + var viewsFeatureProvider = partManager.FeatureProviders.FirstOrDefault(x => x is IApplicationFeatureProvider); + if (viewsFeatureProvider != null) + { + partManager.FeatureProviders.Remove(viewsFeatureProvider); + } + partManager.FeatureProviders.Add(new AbpRazorCompiledItemFeatureProvider(application)); + partManager.ApplicationParts.Add(new AssemblyPart(typeof(AbpAspNetCoreMvcModule).Assembly)); Configure(mvcOptions => diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ViewFeatures/AbpRazorCompiledItemFeatureProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ViewFeatures/AbpRazorCompiledItemFeatureProvider.cs new file mode 100644 index 0000000000..9e2d527e55 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ViewFeatures/AbpRazorCompiledItemFeatureProvider.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.AspNetCore.Mvc.ApplicationParts; +using Microsoft.AspNetCore.Mvc.Razor.Compilation; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.VirtualFileSystem; + +namespace Volo.Abp.AspNetCore.Mvc.ViewFeatures +{ + /// + /// The code for this class comes from + /// https://github.com/dotnet/aspnetcore/blob/master/src/Mvc/Mvc.Razor/src/ApplicationParts/RazorCompiledItemFeatureProvider.cs + /// + public class AbpRazorCompiledItemFeatureProvider : IApplicationFeatureProvider + { + private readonly IAbpApplication _application; + + public AbpRazorCompiledItemFeatureProvider(IAbpApplication application) + { + _application = application; + } + + public void PopulateFeature(IEnumerable parts, ViewsFeature feature) + { + var virtualFileProvider = _application.ServiceProvider + .GetRequiredService(); + + foreach (var provider in parts.OfType()) + { + // Ensure parts do not specify views with differing cases. This is not supported + // at runtime and we should flag at as such for precompiled views. + var duplicates = provider.CompiledItems + .GroupBy(i => i.Identifier, StringComparer.OrdinalIgnoreCase) + .FirstOrDefault(g => g.Count() > 1); + + if (duplicates != null) + { + var viewsDifferingInCase = string.Join(Environment.NewLine, duplicates.Select(d => d.Identifier)); + + var message = string.Join( + Environment.NewLine, + "The following precompiled view paths differ only in case, which is not supported:", + viewsDifferingInCase); + throw new InvalidOperationException(message); + } + + foreach (var item in provider.CompiledItems) + { + // Skip pages existing in the virtual file system. This allows us to replace pre-compiled pages. + if (virtualFileProvider.GetFileInfo(item.Identifier).Exists) + { + continue; + } + + var descriptor = new CompiledViewDescriptor(item); + feature.ViewDescriptors.Add(descriptor); + } + } + } + } +} diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Volo.Abp.Account.Web.IdentityServer.csproj b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Volo.Abp.Account.Web.IdentityServer.csproj index a38a51a16c..17a164e612 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Volo.Abp.Account.Web.IdentityServer.csproj +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Volo.Abp.Account.Web.IdentityServer.csproj @@ -17,10 +17,8 @@ - - diff --git a/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj b/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj index 09e4b2cc6f..a77cbad333 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj +++ b/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj @@ -17,22 +17,18 @@ - - - - - + diff --git a/modules/blogging/src/Volo.Blogging.Web/Volo.Blogging.Web.csproj b/modules/blogging/src/Volo.Blogging.Web/Volo.Blogging.Web.csproj index 19d156f10b..3760fa0539 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Volo.Blogging.Web.csproj +++ b/modules/blogging/src/Volo.Blogging.Web/Volo.Blogging.Web.csproj @@ -23,10 +23,8 @@ - - diff --git a/modules/client-simulation/src/Volo.ClientSimulation.Web/Volo.ClientSimulation.Web.csproj b/modules/client-simulation/src/Volo.ClientSimulation.Web/Volo.ClientSimulation.Web.csproj index 57b87b9e72..e8358805b7 100644 --- a/modules/client-simulation/src/Volo.ClientSimulation.Web/Volo.ClientSimulation.Web.csproj +++ b/modules/client-simulation/src/Volo.ClientSimulation.Web/Volo.ClientSimulation.Web.csproj @@ -20,11 +20,9 @@ - - diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Volo.Docs.Admin.Web.csproj b/modules/docs/src/Volo.Docs.Admin.Web/Volo.Docs.Admin.Web.csproj index 4cad3d9e71..14aa5d167d 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Volo.Docs.Admin.Web.csproj +++ b/modules/docs/src/Volo.Docs.Admin.Web/Volo.Docs.Admin.Web.csproj @@ -23,10 +23,8 @@ - - diff --git a/modules/docs/src/Volo.Docs.Web/Volo.Docs.Web.csproj b/modules/docs/src/Volo.Docs.Web/Volo.Docs.Web.csproj index afec611259..013435afda 100644 --- a/modules/docs/src/Volo.Docs.Web/Volo.Docs.Web.csproj +++ b/modules/docs/src/Volo.Docs.Web/Volo.Docs.Web.csproj @@ -24,14 +24,12 @@ - - + + - - diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Volo.Abp.FeatureManagement.Web.csproj b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Volo.Abp.FeatureManagement.Web.csproj index b4917d34d6..a60c57040e 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Volo.Abp.FeatureManagement.Web.csproj +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Volo.Abp.FeatureManagement.Web.csproj @@ -12,10 +12,8 @@ - - diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj b/modules/identity/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj index 98cdf702d4..f5c9ffc3d4 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj +++ b/modules/identity/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj @@ -16,13 +16,11 @@ - - diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Volo.Abp.PermissionManagement.Web.csproj b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Volo.Abp.PermissionManagement.Web.csproj index 2c1e0b290d..3209ee2e20 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Volo.Abp.PermissionManagement.Web.csproj +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Volo.Abp.PermissionManagement.Web.csproj @@ -13,10 +13,8 @@ - - diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Volo.Abp.SettingManagement.Web.csproj b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Volo.Abp.SettingManagement.Web.csproj index cbf526e751..b37ef515df 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Volo.Abp.SettingManagement.Web.csproj +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Volo.Abp.SettingManagement.Web.csproj @@ -20,10 +20,8 @@ - - diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Volo.Abp.TenantManagement.Web.csproj b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Volo.Abp.TenantManagement.Web.csproj index 56e6d3cae7..c558ea9637 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Volo.Abp.TenantManagement.Web.csproj +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Volo.Abp.TenantManagement.Web.csproj @@ -13,10 +13,8 @@ - - diff --git a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagement.Web.csproj b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagement.Web.csproj index d6e31e865c..6ef492c829 100644 --- a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagement.Web.csproj +++ b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagement.Web.csproj @@ -9,11 +9,9 @@ - - diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj index 41e6fc059d..2fa8cee028 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj @@ -20,11 +20,9 @@ - - From 236a39f0e8309be86f4b7ac8b0abc61179120dd6 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Wed, 20 May 2020 19:36:52 +0800 Subject: [PATCH 02/48] Remove AbpRazorCompiledItemFeatureProvider. --- .../AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs | 11 ---- .../AbpRazorCompiledItemFeatureProvider.cs | 62 ------------------- 2 files changed, 73 deletions(-) delete mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ViewFeatures/AbpRazorCompiledItemFeatureProvider.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs index 775f7ee704..5057f26ca8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs @@ -16,7 +16,6 @@ using System.Reflection; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.AspNetCore.Mvc.Razor; -using Microsoft.AspNetCore.Mvc.Razor.Compilation; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure; using Microsoft.AspNetCore.Routing; @@ -28,7 +27,6 @@ using Volo.Abp.AspNetCore.Mvc.Conventions; using Volo.Abp.AspNetCore.Mvc.DependencyInjection; using Volo.Abp.AspNetCore.Mvc.Json; using Volo.Abp.AspNetCore.Mvc.Localization; -using Volo.Abp.AspNetCore.Mvc.ViewFeatures; using Volo.Abp.AspNetCore.VirtualFileSystem; using Volo.Abp.DependencyInjection; using Volo.Abp.Http; @@ -163,15 +161,6 @@ namespace Volo.Abp.AspNetCore.Mvc var application = context.Services.GetSingletonInstance(); partManager.FeatureProviders.Add(new AbpConventionalControllerFeatureProvider(application)); - - //Replace the built-in RazorCompiledItemFeatureProvider in ASP NET Core. - var viewsFeatureProvider = partManager.FeatureProviders.FirstOrDefault(x => x is IApplicationFeatureProvider); - if (viewsFeatureProvider != null) - { - partManager.FeatureProviders.Remove(viewsFeatureProvider); - } - partManager.FeatureProviders.Add(new AbpRazorCompiledItemFeatureProvider(application)); - partManager.ApplicationParts.Add(new AssemblyPart(typeof(AbpAspNetCoreMvcModule).Assembly)); Configure(mvcOptions => diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ViewFeatures/AbpRazorCompiledItemFeatureProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ViewFeatures/AbpRazorCompiledItemFeatureProvider.cs deleted file mode 100644 index 9e2d527e55..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ViewFeatures/AbpRazorCompiledItemFeatureProvider.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNetCore.Mvc.ApplicationParts; -using Microsoft.AspNetCore.Mvc.Razor.Compilation; -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.VirtualFileSystem; - -namespace Volo.Abp.AspNetCore.Mvc.ViewFeatures -{ - /// - /// The code for this class comes from - /// https://github.com/dotnet/aspnetcore/blob/master/src/Mvc/Mvc.Razor/src/ApplicationParts/RazorCompiledItemFeatureProvider.cs - /// - public class AbpRazorCompiledItemFeatureProvider : IApplicationFeatureProvider - { - private readonly IAbpApplication _application; - - public AbpRazorCompiledItemFeatureProvider(IAbpApplication application) - { - _application = application; - } - - public void PopulateFeature(IEnumerable parts, ViewsFeature feature) - { - var virtualFileProvider = _application.ServiceProvider - .GetRequiredService(); - - foreach (var provider in parts.OfType()) - { - // Ensure parts do not specify views with differing cases. This is not supported - // at runtime and we should flag at as such for precompiled views. - var duplicates = provider.CompiledItems - .GroupBy(i => i.Identifier, StringComparer.OrdinalIgnoreCase) - .FirstOrDefault(g => g.Count() > 1); - - if (duplicates != null) - { - var viewsDifferingInCase = string.Join(Environment.NewLine, duplicates.Select(d => d.Identifier)); - - var message = string.Join( - Environment.NewLine, - "The following precompiled view paths differ only in case, which is not supported:", - viewsDifferingInCase); - throw new InvalidOperationException(message); - } - - foreach (var item in provider.CompiledItems) - { - // Skip pages existing in the virtual file system. This allows us to replace pre-compiled pages. - if (virtualFileProvider.GetFileInfo(item.Identifier).Exists) - { - continue; - } - - var descriptor = new CompiledViewDescriptor(item); - feature.ViewDescriptors.Add(descriptor); - } - } - } - } -} From bfd5e58c7ba03a741d41432a9b9fa91d249fc349 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Fri, 22 May 2020 09:25:28 +0800 Subject: [PATCH 03/48] Ignore external link. --- .../Volo/Docs/Admin/Documents/DocumentAdminAppService.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs index 92b809bf87..744ccac5b6 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs @@ -90,6 +90,12 @@ namespace Volo.Docs.Admin.Documents var documents = new List(); foreach (var leaf in leafs) { + if (leaf.Path.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || + leaf.Path.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) + { + continue; + } + var sourceDocument = await source.GetDocumentAsync(project, leaf.Path, input.LanguageCode, input.Version); documents.Add(sourceDocument); From 3d46235a9bcdfc37704eb15d9e16d410f63ada63 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Fri, 22 May 2020 17:09:48 +0800 Subject: [PATCH 04/48] Remove consoleApp suffix --- templates/console/MyCompanyName.MyProjectName.sln | 2 +- .../HelloWorldService.cs | 2 +- .../MyCompanyName.MyProjectName.csproj} | 0 .../MyProjectNameHostedService.cs} | 6 +++--- .../MyProjectNameModule.cs} | 4 ++-- .../Program.cs | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) rename templates/console/src/{MyCompanyName.MyProjectName.ConsoleApp => MyCompanyName.MyProjectName}/HelloWorldService.cs (82%) rename templates/console/src/{MyCompanyName.MyProjectName.ConsoleApp/MyCompanyName.MyProjectName.ConsoleApp.csproj => MyCompanyName.MyProjectName/MyCompanyName.MyProjectName.csproj} (100%) rename templates/console/src/{MyCompanyName.MyProjectName.ConsoleApp/MyProjectNameConsoleAppHostedService.cs => MyCompanyName.MyProjectName/MyProjectNameHostedService.cs} (85%) rename templates/console/src/{MyCompanyName.MyProjectName.ConsoleApp/MyProjectNameConsoleAppModule.cs => MyCompanyName.MyProjectName/MyProjectNameModule.cs} (54%) rename templates/console/src/{MyCompanyName.MyProjectName.ConsoleApp => MyCompanyName.MyProjectName}/Program.cs (90%) diff --git a/templates/console/MyCompanyName.MyProjectName.sln b/templates/console/MyCompanyName.MyProjectName.sln index 1843fa99b2..c85160d7a0 100644 --- a/templates/console/MyCompanyName.MyProjectName.sln +++ b/templates/console/MyCompanyName.MyProjectName.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyCompanyName.MyProjectName.ConsoleApp", "src\MyCompanyName.MyProjectName.ConsoleApp\MyCompanyName.MyProjectName.ConsoleApp.csproj", "{00A2F7A3-BEC3-48F4-A91C-5A336C32A5D2}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyCompanyName.MyProjectName", "src\MyCompanyName.MyProjectName\MyCompanyName.MyProjectName.csproj", "{00A2F7A3-BEC3-48F4-A91C-5A336C32A5D2}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E8067AED-2B6E-4134-AAF8-9101457D709A}" EndProject diff --git a/templates/console/src/MyCompanyName.MyProjectName.ConsoleApp/HelloWorldService.cs b/templates/console/src/MyCompanyName.MyProjectName/HelloWorldService.cs similarity index 82% rename from templates/console/src/MyCompanyName.MyProjectName.ConsoleApp/HelloWorldService.cs rename to templates/console/src/MyCompanyName.MyProjectName/HelloWorldService.cs index d72a1512d5..ea76681ffd 100644 --- a/templates/console/src/MyCompanyName.MyProjectName.ConsoleApp/HelloWorldService.cs +++ b/templates/console/src/MyCompanyName.MyProjectName/HelloWorldService.cs @@ -1,7 +1,7 @@ using System; using Volo.Abp.DependencyInjection; -namespace MyCompanyName.MyProjectName.ConsoleApp +namespace MyCompanyName.MyProjectName { public class HelloWorldService : ITransientDependency { diff --git a/templates/console/src/MyCompanyName.MyProjectName.ConsoleApp/MyCompanyName.MyProjectName.ConsoleApp.csproj b/templates/console/src/MyCompanyName.MyProjectName/MyCompanyName.MyProjectName.csproj similarity index 100% rename from templates/console/src/MyCompanyName.MyProjectName.ConsoleApp/MyCompanyName.MyProjectName.ConsoleApp.csproj rename to templates/console/src/MyCompanyName.MyProjectName/MyCompanyName.MyProjectName.csproj diff --git a/templates/console/src/MyCompanyName.MyProjectName.ConsoleApp/MyProjectNameConsoleAppHostedService.cs b/templates/console/src/MyCompanyName.MyProjectName/MyProjectNameHostedService.cs similarity index 85% rename from templates/console/src/MyCompanyName.MyProjectName.ConsoleApp/MyProjectNameConsoleAppHostedService.cs rename to templates/console/src/MyCompanyName.MyProjectName/MyProjectNameHostedService.cs index 15c46c91be..5c5c9d89ee 100644 --- a/templates/console/src/MyCompanyName.MyProjectName.ConsoleApp/MyProjectNameConsoleAppHostedService.cs +++ b/templates/console/src/MyCompanyName.MyProjectName/MyProjectNameHostedService.cs @@ -5,13 +5,13 @@ using Microsoft.Extensions.Hosting; using Serilog; using Volo.Abp; -namespace MyCompanyName.MyProjectName.ConsoleApp +namespace MyCompanyName.MyProjectName { - public class MyProjectNameConsoleAppHostedService : IHostedService + public class MyProjectNameHostedService : IHostedService { public Task StartAsync(CancellationToken cancellationToken) { - using (var application = AbpApplicationFactory.Create(options => + using (var application = AbpApplicationFactory.Create(options => { options.UseAutofac(); //Autofac integration options.Services.AddLogging(c => c.AddSerilog()); diff --git a/templates/console/src/MyCompanyName.MyProjectName.ConsoleApp/MyProjectNameConsoleAppModule.cs b/templates/console/src/MyCompanyName.MyProjectName/MyProjectNameModule.cs similarity index 54% rename from templates/console/src/MyCompanyName.MyProjectName.ConsoleApp/MyProjectNameConsoleAppModule.cs rename to templates/console/src/MyCompanyName.MyProjectName/MyProjectNameModule.cs index 2e68bd8de3..9938981484 100644 --- a/templates/console/src/MyCompanyName.MyProjectName.ConsoleApp/MyProjectNameConsoleAppModule.cs +++ b/templates/console/src/MyCompanyName.MyProjectName/MyProjectNameModule.cs @@ -1,13 +1,13 @@ using Volo.Abp.Autofac; using Volo.Abp.Modularity; -namespace MyCompanyName.MyProjectName.ConsoleApp +namespace MyCompanyName.MyProjectName { [DependsOn( typeof(AbpAutofacModule) )] - public class MyProjectNameConsoleAppModule : AbpModule + public class MyProjectNameModule : AbpModule { } diff --git a/templates/console/src/MyCompanyName.MyProjectName.ConsoleApp/Program.cs b/templates/console/src/MyCompanyName.MyProjectName/Program.cs similarity index 90% rename from templates/console/src/MyCompanyName.MyProjectName.ConsoleApp/Program.cs rename to templates/console/src/MyCompanyName.MyProjectName/Program.cs index c20255fb0c..b095d0db73 100644 --- a/templates/console/src/MyCompanyName.MyProjectName.ConsoleApp/Program.cs +++ b/templates/console/src/MyCompanyName.MyProjectName/Program.cs @@ -5,7 +5,7 @@ using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; -namespace MyCompanyName.MyProjectName.ConsoleApp +namespace MyCompanyName.MyProjectName { public class Program { @@ -45,7 +45,7 @@ namespace MyCompanyName.MyProjectName.ConsoleApp Host.CreateDefaultBuilder(args) .ConfigureServices((hostContext, services) => { - services.AddHostedService(); + services.AddHostedService(); }); } } From 4538506453b0604e82a660a03903395dd9fae5ac Mon Sep 17 00:00:00 2001 From: Super Date: Fri, 22 May 2020 18:02:18 +0800 Subject: [PATCH 05/48] #4052 Add a RemoteService tip to Overriding-Service doc --- docs/en/Customizing-Application-Modules-Overriding-Services.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/en/Customizing-Application-Modules-Overriding-Services.md b/docs/en/Customizing-Application-Modules-Overriding-Services.md index b9890b3aca..0dd3d88c2d 100644 --- a/docs/en/Customizing-Application-Modules-Overriding-Services.md +++ b/docs/en/Customizing-Application-Modules-Overriding-Services.md @@ -99,6 +99,8 @@ This class **overrides** the `CreateAsync` method of the `IdentityUserAppService You could completely **re-write** the entire business logic for a user creation without calling the base method. +> It's better to add the attribute `[RemoteService(IsEnabled = false)]` if the [Auto API Controllers](API/Auto-API-Controllers.md) is enabled, otherwise the extra APIs for MyIdentityUser will be generated. + ### Example: Overriding a Domain Service ````csharp From 867d5a03291d3966a1575f987429c014a643b369 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Mon, 25 May 2020 11:28:34 +0800 Subject: [PATCH 06/48] Update usage codes in modules and templates. Resolve #4074 --- docs/en/AspNet-Boilerplate-Migration-Guide.md | 20 ++++++++----------- .../AbpAccountUserMenuContributor.cs | 6 +++--- .../BloggingMenuContributor.cs | 7 +++---- .../Navigation/DocsMenuContributor.cs | 6 ++---- .../AbpIdentityWebMainMenuContributor.cs | 11 ++++------ .../SettingManagementMainMenuContributor.cs | 2 +- ...pTenantManagementWebMainMenuContributor.cs | 5 ++--- .../AbpVirtualFileExplorerMenuContributor.cs | 2 +- .../ProductManagementMenuContributor.cs | 8 +++----- .../Menus/MyProjectNameMenuContributor.cs | 6 +++--- .../Menus/MyProjectNameMenuContributor.cs | 2 +- .../MyProjectNameWebHostMenuContributor.cs | 10 +++++----- 12 files changed, 36 insertions(+), 49 deletions(-) diff --git a/docs/en/AspNet-Boilerplate-Migration-Guide.md b/docs/en/AspNet-Boilerplate-Migration-Guide.md index d47b266839..39dd01eaa4 100644 --- a/docs/en/AspNet-Boilerplate-Migration-Guide.md +++ b/docs/en/AspNet-Boilerplate-Migration-Guide.md @@ -216,9 +216,9 @@ However, it provides the following methods those can be used to query a single e * `FindAsync(id)` returns the entity or null if not found. * `GetAsync(id)` method returns the entity or throws an `EntityNotFoundException` (which causes HTTP 404 status code) if not found. -#### Sync vs Async +#### Sync vs Async -ABP Framework repository has no sync methods (like `Insert`). All the methods are async (like `InsertAsync`). So, if your application has sync repository method usages, convert them to async versions. +ABP Framework repository has no sync methods (like `Insert`). All the methods are async (like `InsertAsync`). So, if your application has sync repository method usages, convert them to async versions. In general, ABP Framework forces you to completely use async everywhere, because mixing async & sync methods is not a recommended approach. @@ -444,7 +444,7 @@ ASP.NET Boilerplate uses Castle Windsor's [logging facility](http://docs.castlep using Castle.Core.Logging; //1: Import Logging namespace public class TaskAppService : ITaskAppService -{ +{ //2: Getting a logger using property injection public ILogger Logger { get; set; } @@ -693,26 +693,22 @@ public class AbpTenantManagementWebMainMenuContributor : IMenuContributor var administrationMenu = context.Menu.GetAdministration(); //Resolve some needed services from the DI container - var authorizationService = context.ServiceProvider - .GetRequiredService(); - var l = context.ServiceProvider - .GetRequiredService>(); + var l = context.GetLocalizer(); var tenantManagementMenuItem = new ApplicationMenuItem( TenantManagementMenuNames.GroupName, l["Menu:TenantManagement"], icon: "fa fa-users"); - + administrationMenu.AddItem(tenantManagementMenuItem); //Conditionally add the "Tenants" menu item based on the permission - if (await authorizationService - .IsGrantedAsync(TenantManagementPermissions.Tenants.Default)) + if (await context.IsGrantedAsync(TenantManagementPermissions.Tenants.Default)) { tenantManagementMenuItem.AddItem( new ApplicationMenuItem( TenantManagementMenuNames.Tenants, - l["Tenants"], + l["Tenants"], url: "/TenantManagement/Tenants")); } } @@ -731,4 +727,4 @@ The following features are not present for the ABP Framework. Here, a list of so * [Real time notification system](https://aspnetboilerplate.com/Pages/Documents/Notification-System) ([#633](https://github.com/abpframework/abp/issues/633)) * [NHibernate Integration](https://aspnetboilerplate.com/Pages/Documents/NHibernate-Integration) ([#339](https://github.com/abpframework/abp/issues/339)) - We don't intent to work on this, but any community contribution welcome. -Some of these features will eventually be implemented. However, you can implement them yourself if they are important for you. If you want, you can [contribute](Contribution/Index.md) to the framework, it is appreciated. \ No newline at end of file +Some of these features will eventually be implemented. However, you can implement them yourself if they are important for you. If you want, you can [contribute](Contribution/Index.md) to the framework, it is appreciated. diff --git a/modules/account/src/Volo.Abp.Account.Web/AbpAccountUserMenuContributor.cs b/modules/account/src/Volo.Abp.Account.Web/AbpAccountUserMenuContributor.cs index 20c42cc4c1..28cb7c7e0a 100644 --- a/modules/account/src/Volo.Abp.Account.Web/AbpAccountUserMenuContributor.cs +++ b/modules/account/src/Volo.Abp.Account.Web/AbpAccountUserMenuContributor.cs @@ -16,8 +16,8 @@ namespace Volo.Abp.Account.Web return Task.CompletedTask; } - var uiResource = context.ServiceProvider.GetRequiredService>(); - var accountResource = context.ServiceProvider.GetRequiredService>(); + var uiResource = context.GetLocalizer(); + var accountResource = context.GetLocalizer(); context.Menu.AddItem(new ApplicationMenuItem("Account.Manage", accountResource["ManageYourProfile"], url: "/Account/Manage", icon: "fa fa-cog", order: 1000, null)); context.Menu.AddItem(new ApplicationMenuItem("Account.Logout", uiResource["Logout"], url: "/Account/Logout", icon: "fa fa-power-off", order: int.MaxValue - 1000)); @@ -25,4 +25,4 @@ namespace Volo.Abp.Account.Web return Task.CompletedTask; } } -} \ No newline at end of file +} diff --git a/modules/blogging/src/Volo.Blogging.Web/BloggingMenuContributor.cs b/modules/blogging/src/Volo.Blogging.Web/BloggingMenuContributor.cs index cf1f12ed02..fec6c30988 100644 --- a/modules/blogging/src/Volo.Blogging.Web/BloggingMenuContributor.cs +++ b/modules/blogging/src/Volo.Blogging.Web/BloggingMenuContributor.cs @@ -19,15 +19,14 @@ namespace Volo.Blogging private async Task ConfigureMainMenu(MenuConfigurationContext context) { - var authorizationService = context.ServiceProvider.GetRequiredService(); - var l = context.ServiceProvider.GetRequiredService>(); + var l = context..GetLocalizer(); - if (await authorizationService.IsGrantedAsync(BloggingPermissions.Blogs.Management)) + if (await context.IsGrantedAsync(BloggingPermissions.Blogs.Management)) { var managementRootMenuItem = new ApplicationMenuItem("BlogManagement", l["Menu:BlogManagement"]); //TODO: Using the same permission. Reconsider. - if (await authorizationService.IsGrantedAsync(BloggingPermissions.Blogs.Management)) + if (await context.IsGrantedAsync(BloggingPermissions.Blogs.Management)) { managementRootMenuItem.AddItem(new ApplicationMenuItem("BlogManagement.Blogs", l["Menu:Blogs"], "/Admin/Blogs")); } diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Navigation/DocsMenuContributor.cs b/modules/docs/src/Volo.Docs.Admin.Web/Navigation/DocsMenuContributor.cs index 4097470c60..51ad4e79b9 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Navigation/DocsMenuContributor.cs +++ b/modules/docs/src/Volo.Docs.Admin.Web/Navigation/DocsMenuContributor.cs @@ -19,17 +19,15 @@ namespace Volo.Docs.Admin.Navigation private async Task ConfigureMainMenu(MenuConfigurationContext context) { - var administrationMenu = context.Menu.GetAdministration(); - var authorizationService = context.ServiceProvider.GetRequiredService(); - var l = context.ServiceProvider.GetRequiredService>(); + var l = context.GetLocalizer(); var rootMenuItem = new ApplicationMenuItem(DocsMenuNames.GroupName, l["Menu:DocumentManagement"], icon: "fa fa-book"); administrationMenu.AddItem(rootMenuItem); - if (await authorizationService.IsGrantedAsync(DocsAdminPermissions.Projects.Default)) + if (await context.IsGrantedAsync(DocsAdminPermissions.Projects.Default)) { rootMenuItem.AddItem(new ApplicationMenuItem(DocsMenuNames.Projects, l["Menu:ProjectManagement"], "/Docs/Admin/Projects")); } diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Navigation/AbpIdentityWebMainMenuContributor.cs b/modules/identity/src/Volo.Abp.Identity.Web/Navigation/AbpIdentityWebMainMenuContributor.cs index b06f590066..784ea35c18 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Navigation/AbpIdentityWebMainMenuContributor.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Navigation/AbpIdentityWebMainMenuContributor.cs @@ -16,17 +16,14 @@ namespace Volo.Abp.Identity.Web.Navigation return; } - var authorizationService = context.ServiceProvider.GetRequiredService(); - - var hasRolePermission = await authorizationService.IsGrantedAsync(IdentityPermissions.Roles.Default); - var hasUserPermission = await authorizationService.IsGrantedAsync(IdentityPermissions.Users.Default); + var hasRolePermission = await context.IsGrantedAsync(IdentityPermissions.Roles.Default); + var hasUserPermission = await context.IsGrantedAsync(IdentityPermissions.Users.Default); if (hasRolePermission || hasUserPermission) { var administrationMenu = context.Menu.GetAdministration(); - - var l = context.ServiceProvider.GetRequiredService>(); + var l = context.GetLocalizer(); var identityMenuItem = new ApplicationMenuItem(IdentityMenuNames.GroupName, l["Menu:IdentityManagement"], icon: "fa fa-id-card-o"); administrationMenu.AddItem(identityMenuItem); @@ -43,4 +40,4 @@ namespace Volo.Abp.Identity.Web.Navigation } } } -} \ No newline at end of file +} diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Navigation/SettingManagementMainMenuContributor.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Navigation/SettingManagementMainMenuContributor.cs index 59c0518d3c..2c9f555f09 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Navigation/SettingManagementMainMenuContributor.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Navigation/SettingManagementMainMenuContributor.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.SettingManagement.Web.Navigation return; } - var l = context.ServiceProvider.GetRequiredService>(); + var l = context.GetLocalizer(); context.Menu .GetAdministration() diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Navigation/AbpTenantManagementWebMainMenuContributor.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Navigation/AbpTenantManagementWebMainMenuContributor.cs index e021538a5c..fe5b403ed7 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Navigation/AbpTenantManagementWebMainMenuContributor.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Navigation/AbpTenantManagementWebMainMenuContributor.cs @@ -18,13 +18,12 @@ namespace Volo.Abp.TenantManagement.Web.Navigation var administrationMenu = context.Menu.GetAdministration(); - var authorizationService = context.ServiceProvider.GetRequiredService(); - var l = context.ServiceProvider.GetRequiredService>(); + var l = context.GetLocalizer(); var tenantManagementMenuItem = new ApplicationMenuItem(TenantManagementMenuNames.GroupName, l["Menu:TenantManagement"], icon: "fa fa-users"); administrationMenu.AddItem(tenantManagementMenuItem); - if (await authorizationService.IsGrantedAsync(TenantManagementPermissions.Tenants.Default)) + if (await context.IsGrantedAsync(TenantManagementPermissions.Tenants.Default)) { tenantManagementMenuItem.AddItem(new ApplicationMenuItem(TenantManagementMenuNames.Tenants, l["Tenants"], url: "/TenantManagement/Tenants")); } diff --git a/modules/virtual-file-explorer/src/Volo.Abp.VirtualFileExplorer.Web/Navigation/AbpVirtualFileExplorerMenuContributor.cs b/modules/virtual-file-explorer/src/Volo.Abp.VirtualFileExplorer.Web/Navigation/AbpVirtualFileExplorerMenuContributor.cs index 3dc652d1c7..c6f2585037 100644 --- a/modules/virtual-file-explorer/src/Volo.Abp.VirtualFileExplorer.Web/Navigation/AbpVirtualFileExplorerMenuContributor.cs +++ b/modules/virtual-file-explorer/src/Volo.Abp.VirtualFileExplorer.Web/Navigation/AbpVirtualFileExplorerMenuContributor.cs @@ -15,7 +15,7 @@ namespace Volo.Abp.VirtualFileExplorer.Web.Navigation return Task.CompletedTask; } - var l = context.ServiceProvider.GetRequiredService>(); + var l = context.GetLocalizer(); context.Menu.Items.Add(new ApplicationMenuItem(VirtualFileExplorerMenuNames.Index, l["Menu:VirtualFileExplorer"], icon: "fa fa-file", url: "/VirtualFileExplorer")); diff --git a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagementMenuContributor.cs b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagementMenuContributor.cs index 0710ebfcfe..2e520a52e4 100644 --- a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagementMenuContributor.cs +++ b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagementMenuContributor.cs @@ -19,13 +19,11 @@ namespace ProductManagement private async Task ConfigureMainMenu(MenuConfigurationContext context) { - var authorizationService = context.ServiceProvider.GetRequiredService(); - var l = context.ServiceProvider.GetRequiredService>(); - + var l = context.GetLocalizer(); var rootMenuItem = new ApplicationMenuItem("ProductManagement", l["Menu:ProductManagement"]); - if (await authorizationService.IsGrantedAsync(ProductManagementPermissions.Products.Default)) + if (await context.IsGrantedAsync(ProductManagementPermissions.Products.Default)) { rootMenuItem.AddItem(new ApplicationMenuItem("Products", l["Menu:Products"], "/ProductManagement/Products")); } @@ -33,4 +31,4 @@ namespace ProductManagement context.Menu.AddItem(rootMenuItem); } } -} \ No newline at end of file +} diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameMenuContributor.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameMenuContributor.cs index 2a12f2ee32..adc54645db 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameMenuContributor.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameMenuContributor.cs @@ -41,7 +41,7 @@ namespace MyCompanyName.MyProjectName.Web.Menus administration.TryRemoveMenuItem(TenantManagementMenuNames.GroupName); } - var l = context.ServiceProvider.GetRequiredService>(); + var l = context.GetLocalizer(); context.Menu.Items.Insert(0, new ApplicationMenuItem("MyProjectName.Home", l["Menu:Home"], "/")); @@ -50,8 +50,8 @@ namespace MyCompanyName.MyProjectName.Web.Menus private Task ConfigureUserMenuAsync(MenuConfigurationContext context) { - var l = context.ServiceProvider.GetRequiredService>(); - var accountStringLocalizer = context.ServiceProvider.GetRequiredService>(); + var l = context.GetLocalizer(); + var accountStringLocalizer = context.GetLocalizer(); var currentUser = context.ServiceProvider.GetRequiredService(); var identityServerUrl = _configuration["AuthServer:Authority"] ?? ""; diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Menus/MyProjectNameMenuContributor.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Menus/MyProjectNameMenuContributor.cs index 5f158525f3..53e3eedcbc 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Menus/MyProjectNameMenuContributor.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Menus/MyProjectNameMenuContributor.cs @@ -26,7 +26,7 @@ namespace MyCompanyName.MyProjectName.Web.Menus administration.TryRemoveMenuItem(TenantManagementMenuNames.GroupName); } - var l = context.ServiceProvider.GetRequiredService>(); + var l = context.GetLocalizer(); context.Menu.Items.Insert(0, new ApplicationMenuItem("MyProjectName.Home", l["Menu:Home"], "/")); } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostMenuContributor.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostMenuContributor.cs index 430a1c237c..22d8fe2731 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostMenuContributor.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostMenuContributor.cs @@ -32,17 +32,17 @@ namespace MyCompanyName.MyProjectName private void AddLogoutItemToMenu(MenuConfigurationContext context) { var currentUser = context.ServiceProvider.GetRequiredService(); - var l = context.ServiceProvider.GetRequiredService>(); + var l = context.GetLocalizer(); if (currentUser.IsAuthenticated) { context.Menu.Items.Add(new ApplicationMenuItem( - "Account.Manage", - l["ManageYourProfile"], + "Account.Manage", + l["ManageYourProfile"], $"{_configuration["AuthServer:Authority"].EnsureEndsWith('/')}Account/Manage", icon: "fa fa-cog", order: int.MaxValue - 1001, - null, + null, "_blank") ); @@ -57,4 +57,4 @@ namespace MyCompanyName.MyProjectName } } } -} \ No newline at end of file +} From 4a254ab59baff3540864c27ae89ddf934d851b0c Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Mon, 25 May 2020 11:43:03 +0800 Subject: [PATCH 07/48] Update BloggingMenuContributor.cs --- .../blogging/src/Volo.Blogging.Web/BloggingMenuContributor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/blogging/src/Volo.Blogging.Web/BloggingMenuContributor.cs b/modules/blogging/src/Volo.Blogging.Web/BloggingMenuContributor.cs index fec6c30988..15d9e75184 100644 --- a/modules/blogging/src/Volo.Blogging.Web/BloggingMenuContributor.cs +++ b/modules/blogging/src/Volo.Blogging.Web/BloggingMenuContributor.cs @@ -19,7 +19,7 @@ namespace Volo.Blogging private async Task ConfigureMainMenu(MenuConfigurationContext context) { - var l = context..GetLocalizer(); + var l = context.GetLocalizer(); if (await context.IsGrantedAsync(BloggingPermissions.Blogs.Management)) { From 27aa66558ffea0a78b96d2094da0adffe7005e78 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 26 May 2020 17:15:09 +0800 Subject: [PATCH 08/48] Support virtual path deployment --- .../Pages/Abp/MultiTenancy/tenant-switch.js | 7 +++++-- .../Themes/Basic/Components/Menu/Default.cshtml | 4 ++-- .../Themes/Basic/Components/Menu/_MenuItem.cshtml | 2 +- .../Toolbar/LanguageSwitch/Default.cshtml | 2 +- .../Components/Toolbar/UserMenu/Default.cshtml | 2 +- .../bootstrap/modal-manager.js | 12 ++++++++---- ...AbpApplicationConfigurationScriptController.cs | 2 ++ .../Authentication/ChallengeAccountController.cs | 4 ++-- .../Mvc/Localization/AbpLanguagesController.cs | 6 +++--- .../Volo/Abp/Ui/Navigation/ApplicationMenuItem.cs | 5 +++-- .../Toolbar/UserLoginLink/Default.cshtml | 2 +- .../Pages/Account/AccountPageModel.cs | 3 ++- .../Pages/Account/Register.cshtml.cs | 2 +- .../Pages/VirtualFileExplorer/Index.cshtml.cs | 15 ++++++++++++--- .../Controllers/HomeController.cs | 2 +- .../Controllers/HomeController.cs | 2 +- .../Pages/Index.cshtml | 2 +- .../Pages/Index.cshtml | 2 +- 18 files changed, 48 insertions(+), 28 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/tenant-switch.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/tenant-switch.js index 6b9e348f1d..106eea205a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/tenant-switch.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/tenant-switch.js @@ -1,10 +1,13 @@ (function($) { - var tenantSwitchModal = new abp.ModalManager(abp.appPath + 'Abp/MultiTenancy/TenantSwitchModal'); + var tenantSwitchModal = new abp.ModalManager(); $(function() { $('#AbpTenantSwitchLink').click(function(e) { e.preventDefault(); + tenantSwitchModal.setOptions({ + viewUrl : abp.appPath + 'Abp/MultiTenancy/TenantSwitchModal' + }) tenantSwitchModal.open(); }); @@ -13,4 +16,4 @@ }); }); -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/Default.cshtml index 0c6b5d8a3b..b6a7a559bb 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/Default.cshtml +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/Default.cshtml @@ -10,7 +10,7 @@ if (menuItem.Url != null) { } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/_MenuItem.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/_MenuItem.cshtml index eaec9fc7c4..dd517b91ff 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/_MenuItem.cshtml +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/_MenuItem.cshtml @@ -9,7 +9,7 @@ { if (Model.Url != null) { - + @if (Model.Icon != null) { if (Model.Icon.StartsWith("fa")) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/Default.cshtml index 65ca8d940e..8b7ea1bf2c 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/Default.cshtml +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/Default.cshtml @@ -12,7 +12,7 @@ diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/Default.cshtml index d1738165d3..3b06904d63 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/Default.cshtml +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/Default.cshtml @@ -28,7 +28,7 @@ var cssClass = string.IsNullOrEmpty(menuItem.CssClass) ? string.Empty : menuItem.CssClass; var disabled = menuItem.IsDisabled ? "disabled" : string.Empty; - + @if (menuItem.Icon != null) { if (menuItem.Icon.StartsWith("fa")) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js index cc4122a373..4e1c89afdb 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js @@ -112,7 +112,7 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f $firstVisibleInput.focus(); }); - var modalClass = abp.modals[options.modalClass]; + var modalClass = abp.modals[_options.modalClass]; if (modalClass) { _modalObject = new modalClass(); _modalObject.init && _modalObject.init(_publicApi, _args); //TODO: Remove later @@ -127,14 +127,14 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f _args = args || {}; _createContainer(_modalId) - .load(options.viewUrl, $.param(_args), function (response, status, xhr) { + .load(_options.viewUrl, $.param(_args), function (response, status, xhr) { if (status === "error") { //TODO: Handle! return; }; - if (options.scriptUrl) { - abp.ResourceLoader.loadScript(options.scriptUrl, function () { + if (_options.scriptUrl) { + abp.ResourceLoader.loadScript(_options.scriptUrl, function () { _initAndShowModal(); }); } else { @@ -192,6 +192,10 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f return _options; }, + setOptions: function(options){ + _options = options; + }, + setResult: function () { _onResultCallbacks.triggerAll(_publicApi, arguments); }, diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs index d4ce99dc12..7234fb4f4d 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs @@ -55,6 +55,8 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations script.AppendLine(); script.AppendLine($"$.extend(true, abp, {_jsonSerializer.Serialize(config, indented: true)})"); script.AppendLine(); + script.AppendLine($"abp.appPath = abp.toAbsAppPath('{Request.PathBase}/')"); + script.AppendLine(); script.AppendLine("abp.event.trigger('abp.configurationInitialized');"); script.AppendLine(); script.Append("})();"); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs index 36e0bebfd6..15854e10a6 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs @@ -86,7 +86,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authentication protected virtual string GetAppHomeUrl() { - return "/"; + return "~/"; } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs index 3f25eb2f84..06b9c9a620 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs @@ -32,14 +32,14 @@ namespace Volo.Abp.AspNetCore.Mvc.Localization return Redirect(GetRedirectUrl(returnUrl)); } - return Redirect("/"); + return Redirect("~/"); } private string GetRedirectUrl(string returnUrl) { if (returnUrl.IsNullOrEmpty()) { - return "/"; + return "~/"; } if (Url.IsLocalUrl(returnUrl)) @@ -47,7 +47,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Localization return returnUrl; } - return "/"; + return "~/"; } } } diff --git a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/ApplicationMenuItem.cs b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/ApplicationMenuItem.cs index d4960c883e..4400fe7b46 100644 --- a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/ApplicationMenuItem.cs +++ b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/ApplicationMenuItem.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using JetBrains.Annotations; @@ -101,7 +102,7 @@ namespace Volo.Abp.UI.Navigation Name = name; DisplayName = displayName; - Url = url; + Url = url?.EnsureStartsWith('~'); Icon = icon; Order = order; CustomData = customData; @@ -133,4 +134,4 @@ namespace Volo.Abp.UI.Navigation return $"[ApplicationMenuItem] Name = {Name}"; } } -} \ No newline at end of file +} diff --git a/modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/Default.cshtml b/modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/Default.cshtml index 451a65b2dc..2331409857 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/Default.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/Default.cshtml @@ -1,4 +1,4 @@ @using Localization.Resources.AbpUi @using Microsoft.AspNetCore.Mvc.Localization @inject IHtmlLocalizer L -@L["Login"] +@L["Login"] diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccountPageModel.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccountPageModel.cs index f5dbba8b2f..41bdd93647 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccountPageModel.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccountPageModel.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Volo.Abp.Account.Localization; @@ -73,7 +74,7 @@ namespace Volo.Abp.Account.Web.Pages.Account protected virtual string GetAppHomeUrl() { - return "/"; //TODO: ??? + return "~/"; //TODO: ??? } } } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs index 3b5a5b2cd1..87c7131305 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs @@ -59,7 +59,7 @@ namespace Volo.Abp.Account.Web.Pages.Account await SignInManager.SignInAsync(user, isPersistent: false); - return Redirect(ReturnUrl ?? "/"); //TODO: How to ensure safety? IdentityServer requires it however it should be checked somehow! + return Redirect(ReturnUrl ?? "~/"); //TODO: How to ensure safety? IdentityServer requires it however it should be checked somehow! } protected virtual async Task CheckSelfRegistrationAsync() diff --git a/modules/virtual-file-explorer/src/Volo.Abp.VirtualFileExplorer.Web/Pages/VirtualFileExplorer/Index.cshtml.cs b/modules/virtual-file-explorer/src/Volo.Abp.VirtualFileExplorer.Web/Pages/VirtualFileExplorer/Index.cshtml.cs index 4c79e27240..bb48951825 100644 --- a/modules/virtual-file-explorer/src/Volo.Abp.VirtualFileExplorer.Web/Pages/VirtualFileExplorer/Index.cshtml.cs +++ b/modules/virtual-file-explorer/src/Volo.Abp.VirtualFileExplorer.Web/Pages/VirtualFileExplorer/Index.cshtml.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.FileProviders; using NUglify.Helpers; @@ -42,7 +43,7 @@ namespace Volo.Abp.VirtualFileExplorer.Web.Pages.VirtualFileExplorer .Where(d => VirtualFileExplorerConsts.AllowFileInfoTypes.Contains(d.GetType().Name)) .OrderByDescending(f => f.IsDirectory).ToList(); - PagerModel = new PagerModel(query.Count, PageSize, CurrentPage, PageSize, $"/VirtualFileExplorer?Path={Path}&PageSize={PageSize}"); + PagerModel = new PagerModel(query.Count, PageSize, CurrentPage, PageSize, $"{ResolveUrl()}VirtualFileExplorer?Path={Path}&PageSize={PageSize}"); SetViewModel(query.Skip((CurrentPage - 1) * PageSize).Take(PageSize)); SetPathNavigation(); @@ -71,7 +72,7 @@ namespace Volo.Abp.VirtualFileExplorer.Web.Pages.VirtualFileExplorer fileInfoViewModel.Icon = "fas fa-folder"; fileInfoViewModel.FileType = "folder"; fileInfoViewModel.Length = "/"; - fileInfoViewModel.FileName =$"{fileInfo.Name}"; + fileInfoViewModel.FileName =$"{fileInfo.Name}"; } else { @@ -86,7 +87,7 @@ namespace Volo.Abp.VirtualFileExplorer.Web.Pages.VirtualFileExplorer { var navigationBuild = new StringBuilder(); var pathArray = Path.Split('/').Where(p => !p.IsNullOrWhiteSpace()); - var href = "/VirtualFileExplorer?path="; + var href = $"{ResolveUrl()}VirtualFileExplorer?path="; navigationBuild.Append($"