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 1/8] 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 2/8] 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 6944d7836d165485a62bd693dd73f385943c5b7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 1 Jun 2020 22:42:38 +0300 Subject: [PATCH 3/8] Use ApplicationParts.AddIfNotContains for the AbpAspNetCoreMvcModule --- .../AbpMvcBuilderExtensions.cs | 17 ++++++++++++++--- .../AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs | 9 ++------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpMvcBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpMvcBuilderExtensions.cs index 77b517bc45..c7f3777466 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpMvcBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpMvcBuilderExtensions.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; using System.Reflection; using Microsoft.AspNetCore.Mvc.ApplicationParts; @@ -8,13 +9,23 @@ namespace Microsoft.Extensions.DependencyInjection { public static void AddApplicationPartIfNotExists(this IMvcBuilder mvcBuilder, Assembly assembly) { - if (mvcBuilder.PartManager.ApplicationParts.Any( + mvcBuilder.PartManager.ApplicationParts.AddIfNotContains(assembly); + } + + public static void AddApplicationPartIfNotExists(this IMvcCoreBuilder mvcCoreBuilder, Assembly assembly) + { + mvcCoreBuilder.PartManager.ApplicationParts.AddIfNotContains(assembly); + } + + public static void AddIfNotContains(this IList applicationParts, Assembly assembly) + { + if (applicationParts.Any( p => p is AssemblyPart assemblyPart && assemblyPart.Assembly == assembly)) { return; } - mvcBuilder.PartManager.ApplicationParts.Add(new AssemblyPart(assembly)); + applicationParts.Add(new AssemblyPart(assembly)); } } } 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 1657ae10c1..a923fee3f1 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 @@ -161,7 +161,7 @@ namespace Volo.Abp.AspNetCore.Mvc var application = context.Services.GetSingletonInstance(); partManager.FeatureProviders.Add(new AbpConventionalControllerFeatureProvider(application)); - partManager.ApplicationParts.Add(new AssemblyPart(typeof(AbpAspNetCoreMvcModule).Assembly)); + partManager.ApplicationParts.AddIfNotContains(typeof(AbpAspNetCoreMvcModule).Assembly); Configure(mvcOptions => { @@ -220,12 +220,7 @@ namespace Volo.Abp.AspNetCore.Mvc { foreach (var moduleAssembly in moduleAssemblies) { - if (partManager.ApplicationParts.OfType().Any(p => p.Assembly == moduleAssembly)) - { - continue; - } - - partManager.ApplicationParts.Add(new AssemblyPart(moduleAssembly)); + partManager.ApplicationParts.AddIfNotContains(moduleAssembly); } } } From 766b194687dedbd0966309cebd7b0a60c503847f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 1 Jun 2020 23:21:30 +0300 Subject: [PATCH 4/8] Add test for SortByDependencies --- .../Collections/Generic/AbpListExtensions.cs | 5 ++- .../Generic/AbpListExtensions_Tests.cs | 34 ++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Core/System/Collections/Generic/AbpListExtensions.cs b/framework/src/Volo.Abp.Core/System/Collections/Generic/AbpListExtensions.cs index a123236a4e..ec7a640a39 100644 --- a/framework/src/Volo.Abp.Core/System/Collections/Generic/AbpListExtensions.cs +++ b/framework/src/Volo.Abp.Core/System/Collections/Generic/AbpListExtensions.cs @@ -180,7 +180,10 @@ namespace System.Collections.Generic /// The type of the members of values. /// A list of objects to sort /// Function to resolve the dependencies - /// + /// + /// Returns a new list ordered by dependencies. + /// If A depends on B, then B will come before than A in the resulting list. + /// public static List SortByDependencies(this IEnumerable source, Func> getDependencies) { /* See: http://www.codeproject.com/Articles/869059/Topological-sorting-in-Csharp diff --git a/framework/test/Volo.Abp.Core.Tests/System/Collections/Generic/AbpListExtensions_Tests.cs b/framework/test/Volo.Abp.Core.Tests/System/Collections/Generic/AbpListExtensions_Tests.cs index 93e2ef5824..9c8926f38a 100644 --- a/framework/test/Volo.Abp.Core.Tests/System/Collections/Generic/AbpListExtensions_Tests.cs +++ b/framework/test/Volo.Abp.Core.Tests/System/Collections/Generic/AbpListExtensions_Tests.cs @@ -1,5 +1,6 @@ using System.Linq; using Shouldly; +using Volo.Abp; using Xunit; namespace System.Collections.Generic @@ -171,5 +172,36 @@ namespace System.Collections.Generic list[1].ShouldBe(42); list[2].ShouldBe(3); } + + [Fact] + public void SortByDependencies() + { + var dependencies = new Dictionary + { + {'A', new[] {'B', 'G'}}, + {'B', new[] {'C', 'E'}}, + {'C', new[] {'D'}}, + {'D', new char[0]}, + {'E', new[] {'C', 'F'}}, + {'F', new[] {'C'}}, + {'G', new[] {'F'}} + }; + + for (int i = 0; i < 3; i++) + { + var list = RandomHelper + .GenerateRandomizedList(new char[] {'A', 'B', 'C', 'D', 'E', 'F', 'G'}); + + list = list.SortByDependencies(c => dependencies[c]); + + foreach (var dependency in dependencies) + { + foreach (var dependedValue in dependency.Value) + { + list.IndexOf(dependency.Key).ShouldBeGreaterThan(list.IndexOf(dependedValue)); + } + } + } + } } -} +} \ No newline at end of file From 2c676a2077c314fe949e68d297a0ec898201bc51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 2 Jun 2020 01:21:57 +0300 Subject: [PATCH 5/8] Move ConfigureServices from ModuleLoader to AbpApplicationBase This makes possible to access the Modules list in the ConfigureServices methods of the modules. --- .../Volo/Abp/AbpApplicationBase.cs | 74 ++++++++++++++++++- .../Volo/Abp/Modularity/ModuleLoader.cs | 70 ------------------ 2 files changed, 73 insertions(+), 71 deletions(-) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs b/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs index 8036760f6a..1e5b251ca0 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.DependencyInjection; @@ -42,6 +43,7 @@ namespace Volo.Abp services.AddCoreAbpServices(this, options); Modules = LoadModules(services, options); + ConfigureServices(); } public virtual void Shutdown() @@ -75,7 +77,7 @@ namespace Volo.Abp } } - private IReadOnlyList LoadModules(IServiceCollection services, AbpApplicationCreationOptions options) + protected virtual IReadOnlyList LoadModules(IServiceCollection services, AbpApplicationCreationOptions options) { return services .GetSingletonInstance() @@ -85,5 +87,75 @@ namespace Volo.Abp options.PlugInSources ); } + + //TODO: We can extract a new class for this + protected virtual void ConfigureServices() + { + var context = new ServiceConfigurationContext(Services); + Services.AddSingleton(context); + + foreach (var module in Modules) + { + if (module.Instance is AbpModule abpModule) + { + abpModule.ServiceConfigurationContext = context; + } + } + + //PreConfigureServices + foreach (var module in Modules.Where(m => m.Instance is IPreConfigureServices)) + { + try + { + ((IPreConfigureServices)module.Instance).PreConfigureServices(context); + } + catch (Exception ex) + { + throw new AbpInitializationException($"An error occurred during {nameof(IPreConfigureServices.PreConfigureServices)} phase of the module {module.Type.AssemblyQualifiedName}. See the inner exception for details.", ex); + } + } + + //ConfigureServices + foreach (var module in Modules) + { + if (module.Instance is AbpModule abpModule) + { + if (!abpModule.SkipAutoServiceRegistration) + { + Services.AddAssembly(module.Type.Assembly); + } + } + + try + { + module.Instance.ConfigureServices(context); + } + catch (Exception ex) + { + throw new AbpInitializationException($"An error occurred during {nameof(IAbpModule.ConfigureServices)} phase of the module {module.Type.AssemblyQualifiedName}. See the inner exception for details.", ex); + } + } + + //PostConfigureServices + foreach (var module in Modules.Where(m => m.Instance is IPostConfigureServices)) + { + try + { + ((IPostConfigureServices)module.Instance).PostConfigureServices(context); + } + catch (Exception ex) + { + throw new AbpInitializationException($"An error occurred during {nameof(IPostConfigureServices.PostConfigureServices)} phase of the module {module.Type.AssemblyQualifiedName}. See the inner exception for details.", ex); + } + } + + foreach (var module in Modules) + { + if (module.Instance is AbpModule abpModule) + { + abpModule.ServiceConfigurationContext = null; + } + } + } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleLoader.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleLoader.cs index 374e1adb78..7e7e69d457 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleLoader.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleLoader.cs @@ -20,7 +20,6 @@ namespace Volo.Abp.Modularity var modules = GetDescriptors(services, startupModuleType, plugInSources); modules = SortByDependency(modules, startupModuleType); - ConfigureServices(modules, services); return modules.ToArray(); } @@ -89,75 +88,6 @@ namespace Volo.Abp.Modularity return module; } - protected virtual void ConfigureServices(List modules, IServiceCollection services) - { - var context = new ServiceConfigurationContext(services); - services.AddSingleton(context); - - foreach (var module in modules) - { - if (module.Instance is AbpModule abpModule) - { - abpModule.ServiceConfigurationContext = context; - } - } - - //PreConfigureServices - foreach (var module in modules.Where(m => m.Instance is IPreConfigureServices)) - { - try - { - ((IPreConfigureServices)module.Instance).PreConfigureServices(context); - } - catch (Exception ex) - { - throw new AbpInitializationException($"An error occurred during {nameof(IPreConfigureServices.PreConfigureServices)} phase of the module {module.Type.AssemblyQualifiedName}. See the inner exception for details.", ex); - } - } - - //ConfigureServices - foreach (var module in modules) - { - if (module.Instance is AbpModule abpModule) - { - if (!abpModule.SkipAutoServiceRegistration) - { - services.AddAssembly(module.Type.Assembly); - } - } - - try - { - module.Instance.ConfigureServices(context); - } - catch (Exception ex) - { - throw new AbpInitializationException($"An error occurred during {nameof(IAbpModule.ConfigureServices)} phase of the module {module.Type.AssemblyQualifiedName}. See the inner exception for details.", ex); - } - } - - //PostConfigureServices - foreach (var module in modules.Where(m => m.Instance is IPostConfigureServices)) - { - try - { - ((IPostConfigureServices)module.Instance).PostConfigureServices(context); - } - catch (Exception ex) - { - throw new AbpInitializationException($"An error occurred during {nameof(IPostConfigureServices.PostConfigureServices)} phase of the module {module.Type.AssemblyQualifiedName}. See the inner exception for details.", ex); - } - } - - foreach (var module in modules) - { - if (module.Instance is AbpModule abpModule) - { - abpModule.ServiceConfigurationContext = null; - } - } - } - protected virtual void SetDependencies(List modules, AbpModuleDescriptor module) { foreach (var dependedModuleType in AbpModuleHelper.FindDependedModuleTypes(module.Type)) From cd4c136f2a49353f62c7f354a1930ad769a690a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 2 Jun 2020 01:22:30 +0300 Subject: [PATCH 6/8] Sort application parts by considering the module dependencies. --- .../AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs | 9 + .../AspNetCore/Mvc/ApplicationPartSorter.cs | 159 ++++++++++++++++++ 2 files changed, 168 insertions(+) create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationPartSorter.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 a923fee3f1..263178e0ed 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 @@ -10,6 +10,7 @@ using Microsoft.Extensions.Options; using Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Net; using System.Reflection; @@ -179,6 +180,14 @@ namespace Volo.Abp.AspNetCore.Mvc }); } + public override void PostConfigureServices(ServiceConfigurationContext context) + { + ApplicationPartSorter.Sort( + context.Services.GetSingletonInstance(), + context.Services.GetSingletonInstance() + ); + } + public override void OnApplicationInitialization(ApplicationInitializationContext context) { AddApplicationParts(context); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationPartSorter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationPartSorter.cs new file mode 100644 index 0000000000..76dc950d11 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationPartSorter.cs @@ -0,0 +1,159 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using Microsoft.AspNetCore.Mvc.ApplicationParts; +using Volo.Abp.Modularity; + +namespace Volo.Abp.AspNetCore.Mvc +{ + /// + /// This class is used to align order of the MVC Application Parts with the order of + /// ABP module dependencies. + /// + public static class ApplicationPartSorter + { + public static void Sort(ApplicationPartManager partManager, IModuleContainer moduleContainer) + { + /* Performing a double Reverse() to preserve the original order for non-sorted parts + */ + + var dependencyDictionary = CreateDependencyDictionary(partManager, moduleContainer); + + var sortedParts = partManager + .ApplicationParts + .Reverse() //First Revers + .SortByDependencies(p => dependencyDictionary[p]); + + sortedParts.Reverse(); //Reverse again + + //Replace the original parts with the sorted parts + partManager.ApplicationParts.Clear(); + foreach (var applicationPart in sortedParts) + { + partManager.ApplicationParts.Add(applicationPart); + } + } + + private static Dictionary> CreateDependencyDictionary( + ApplicationPartManager partManager, IModuleContainer moduleContainer) + { + var dependencyDictionary = new Dictionary>(); + + foreach (var applicationPart in partManager.ApplicationParts) + { + dependencyDictionary[applicationPart] = + CreateDependencyList(applicationPart, partManager, moduleContainer); + } + + return dependencyDictionary; + } + + private static List CreateDependencyList( + ApplicationPart applicationPart, + ApplicationPartManager partManager, + IModuleContainer moduleContainer) + { + var list = new List(); + + if (applicationPart is AssemblyPart assemblyPart) + { + AddDependencies(list, assemblyPart, partManager, moduleContainer); + } + else if (applicationPart is CompiledRazorAssemblyPart compiledRazorAssemblyPart) + { + AddDependencies(list, compiledRazorAssemblyPart, partManager, moduleContainer); + } + + return list; + } + + private static void AddDependencies( + List list, + AssemblyPart assemblyPart, + ApplicationPartManager partManager, + IModuleContainer moduleContainer) + { + var dependedAssemblyParts = GetDependedAssemblyParts( + partManager, + moduleContainer, + assemblyPart + ); + + list.AddRange(dependedAssemblyParts); + + foreach (var dependedAssemblyPart in dependedAssemblyParts) + { + var viewsPart = GetViewsPartOrNull(partManager, dependedAssemblyPart); + if (viewsPart != null) + { + list.Add(viewsPart); + } + } + } + + private static void AddDependencies( + List list, + CompiledRazorAssemblyPart compiledRazorAssemblyPart, + ApplicationPartManager partManager, + IModuleContainer moduleContainer) + { + if (!compiledRazorAssemblyPart.Name.EndsWith(".Views")) + { + return; + } + + var originalAssemblyPart = GetOriginalAssemblyPartOrNull(compiledRazorAssemblyPart, partManager); + if (originalAssemblyPart == null) + { + return; + } + + list.Add(originalAssemblyPart); + } + + private static AssemblyPart[] GetDependedAssemblyParts( + ApplicationPartManager partManager, + IModuleContainer moduleContainer, + AssemblyPart assemblyPart) + { + var moduleDescriptor = GetModuleDescriptorForAssemblyOrNull(moduleContainer, assemblyPart.Assembly); + if (moduleDescriptor == null) + { + return Array.Empty(); + } + + var moduleDependedAssemblies = moduleDescriptor.Dependencies.Select(d => d.Assembly).ToArray(); + return partManager.ApplicationParts + .OfType() + .Where(a => a.Assembly.IsIn(moduleDependedAssemblies)) + .Distinct() + .ToArray(); + } + + private static CompiledRazorAssemblyPart GetViewsPartOrNull(ApplicationPartManager partManager, + ApplicationPart assemblyPart) + { + return partManager + .ApplicationParts + .OfType() + .FirstOrDefault(p => p.Name == assemblyPart.Name + ".Views"); + } + + private static AssemblyPart GetOriginalAssemblyPartOrNull( + CompiledRazorAssemblyPart compiledRazorAssemblyPart, + ApplicationPartManager partManager) + { + var originalAssemblyName = compiledRazorAssemblyPart.Name.RemovePostFix(".Views"); + return partManager.ApplicationParts + .OfType() + .FirstOrDefault(p => p.Assembly.GetName().Name == originalAssemblyName); + } + + private static IAbpModuleDescriptor GetModuleDescriptorForAssemblyOrNull(IModuleContainer moduleContainer, + Assembly assembly) + { + return moduleContainer.Modules.FirstOrDefault(m => m.Assembly == assembly); + } + } +} \ No newline at end of file From 15be18d77365b859125cbd5c9cb3a5b243d9ab85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 2 Jun 2020 01:29:05 +0300 Subject: [PATCH 7/8] Format code for ApplicationPartSorter.cs --- .../AspNetCore/Mvc/ApplicationPartSorter.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationPartSorter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationPartSorter.cs index 76dc950d11..85fc13c840 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationPartSorter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationPartSorter.cs @@ -123,7 +123,11 @@ namespace Volo.Abp.AspNetCore.Mvc return Array.Empty(); } - var moduleDependedAssemblies = moduleDescriptor.Dependencies.Select(d => d.Assembly).ToArray(); + var moduleDependedAssemblies = moduleDescriptor + .Dependencies + .Select(d => d.Assembly) + .ToArray(); + return partManager.ApplicationParts .OfType() .Where(a => a.Assembly.IsIn(moduleDependedAssemblies)) @@ -134,10 +138,11 @@ namespace Volo.Abp.AspNetCore.Mvc private static CompiledRazorAssemblyPart GetViewsPartOrNull(ApplicationPartManager partManager, ApplicationPart assemblyPart) { + var viewsAssemblyName = assemblyPart.Name + ".Views"; return partManager .ApplicationParts .OfType() - .FirstOrDefault(p => p.Name == assemblyPart.Name + ".Views"); + .FirstOrDefault(p => p.Name == viewsAssemblyName); } private static AssemblyPart GetOriginalAssemblyPartOrNull( @@ -147,13 +152,16 @@ namespace Volo.Abp.AspNetCore.Mvc var originalAssemblyName = compiledRazorAssemblyPart.Name.RemovePostFix(".Views"); return partManager.ApplicationParts .OfType() - .FirstOrDefault(p => p.Assembly.GetName().Name == originalAssemblyName); + .FirstOrDefault(p => p.Name == originalAssemblyName); } - private static IAbpModuleDescriptor GetModuleDescriptorForAssemblyOrNull(IModuleContainer moduleContainer, + private static IAbpModuleDescriptor GetModuleDescriptorForAssemblyOrNull( + IModuleContainer moduleContainer, Assembly assembly) { - return moduleContainer.Modules.FirstOrDefault(m => m.Assembly == assembly); + return moduleContainer + .Modules + .FirstOrDefault(m => m.Assembly == assembly); } } } \ No newline at end of file From 66b68e225462cdef37af0c6e0fdaf436671b7761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 2 Jun 2020 02:46:39 +0300 Subject: [PATCH 8/8] Add missing tag helpers --- .../Pages/TenantManagement/_ViewImports.cshtml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/_ViewImports.cshtml b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/_ViewImports.cshtml index d1ac64721f..c1da1f5f10 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/_ViewImports.cshtml +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/_ViewImports.cshtml @@ -1,2 +1,4 @@ @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers -@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap \ No newline at end of file +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling \ No newline at end of file