From c723ba0224cb177aff6704b13ea9a97ac1e0ca55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 22 Feb 2017 15:02:13 +0300 Subject: [PATCH] Fixed module load order bug. added Bootstrap project. --- Volo.Abp.sln | 7 +++++ .../AbpDesk.Web.Mvc/AbpDeskWebMvcModule.cs | 4 +-- src/AbpDesk/AbpDesk.Web.Mvc/project.json | 2 +- .../AbpAspNetCoreMvcUiBootstrapModule.cs | 27 +++++++++++++++++++ .../Properties/launchSettings.json | 27 +++++++++++++++++++ .../Shared/Components/AbpMenu/Default.cshtml | 22 +++++++++++++++ ...Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.xproj | 25 +++++++++++++++++ .../project.json | 22 +++++++++++++++ .../web.config | 14 ++++++++++ .../Volo/Abp/Modularity/ModuleLoader.cs | 13 +++++---- 10 files changed, 155 insertions(+), 8 deletions(-) create mode 100644 src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/AbpAspNetCoreMvcUiBootstrapModule.cs create mode 100644 src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Properties/launchSettings.json create mode 100644 src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/Components/AbpMenu/Default.cshtml create mode 100644 src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.xproj create mode 100644 src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/project.json create mode 100644 src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/web.config diff --git a/Volo.Abp.sln b/Volo.Abp.sln index 6ffdec2cd9..a2b93b71e6 100644 --- a/Volo.Abp.sln +++ b/Volo.Abp.sln @@ -90,6 +90,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Volo.Abp.AspNetCore.Embedde EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Abp.UI", "Abp.UI", "{6F776E78-862A-4147-86BA-12B6B64E8958}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Volo.Abp.AspNetCore.Mvc.UI.Bootstrap", "src\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.xproj", "{C761A3F7-787D-4C7E-A41C-5FAB07F6B774}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -208,6 +210,10 @@ Global {B6182BF1-9EC6-403D-A42C-D6441CF7B390}.Debug|Any CPU.Build.0 = Debug|Any CPU {B6182BF1-9EC6-403D-A42C-D6441CF7B390}.Release|Any CPU.ActiveCfg = Release|Any CPU {B6182BF1-9EC6-403D-A42C-D6441CF7B390}.Release|Any CPU.Build.0 = Release|Any CPU + {C761A3F7-787D-4C7E-A41C-5FAB07F6B774}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C761A3F7-787D-4C7E-A41C-5FAB07F6B774}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C761A3F7-787D-4C7E-A41C-5FAB07F6B774}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C761A3F7-787D-4C7E-A41C-5FAB07F6B774}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -249,5 +255,6 @@ Global {BF9AB22C-F48D-4DDE-A894-BC28EB37166B} = {6F776E78-862A-4147-86BA-12B6B64E8958} {B6182BF1-9EC6-403D-A42C-D6441CF7B390} = {4C753F64-0C93-4D65-96C2-A40893AFC1E8} {6F776E78-862A-4147-86BA-12B6B64E8958} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} + {C761A3F7-787D-4C7E-A41C-5FAB07F6B774} = {6F776E78-862A-4147-86BA-12B6B64E8958} EndGlobalSection EndGlobal diff --git a/src/AbpDesk/AbpDesk.Web.Mvc/AbpDeskWebMvcModule.cs b/src/AbpDesk/AbpDesk.Web.Mvc/AbpDeskWebMvcModule.cs index 78fd087763..2b725ccd1c 100644 --- a/src/AbpDesk/AbpDesk.Web.Mvc/AbpDeskWebMvcModule.cs +++ b/src/AbpDesk/AbpDesk.Web.Mvc/AbpDeskWebMvcModule.cs @@ -8,7 +8,7 @@ using Microsoft.Extensions.Logging; using Volo.Abp; using Volo.Abp.AspNetCore.EmbeddedFiles; using Volo.Abp.AspNetCore.Modularity; -using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.Modularity; using Volo.Abp.UI.Navigation; @@ -16,7 +16,7 @@ namespace AbpDesk.Web.Mvc { [DependsOn( typeof(AbpAspNetCoreEmbeddedFilesModule), - typeof(AbpAspNetCoreMvcUiModule), + typeof(AbpAspNetCoreMvcUiBootstrapModule), typeof(AbpDeskApplicationModule), typeof(AbpDeskEntityFrameworkCoreModule))] public class AbpDeskWebMvcModule : AbpModule diff --git a/src/AbpDesk/AbpDesk.Web.Mvc/project.json b/src/AbpDesk/AbpDesk.Web.Mvc/project.json index 721663d761..ea06f22768 100644 --- a/src/AbpDesk/AbpDesk.Web.Mvc/project.json +++ b/src/AbpDesk/AbpDesk.Web.Mvc/project.json @@ -24,7 +24,7 @@ "Volo.Abp.AspNetCore.Mvc": "1.0.0-*", "AbpDesk.EntityFrameworkCore": "1.0.0-*", "AbpDesk.Application": "1.0.0-*", - "Volo.Abp.AspNetCore.Mvc.UI": "1.0.0-*", + "Volo.Abp.AspNetCore.Mvc.UI.Bootstrap": "1.0.0-*", "Volo.Abp.AspNetCore.EmbeddedFiles": "1.0.0-*" }, diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/AbpAspNetCoreMvcUiBootstrapModule.cs b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/AbpAspNetCoreMvcUiBootstrapModule.cs new file mode 100644 index 0000000000..9ca7b4c676 --- /dev/null +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/AbpAspNetCoreMvcUiBootstrapModule.cs @@ -0,0 +1,27 @@ +using System.Reflection; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.EmbeddedFiles; +using Volo.Abp.Modularity; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap +{ + [DependsOn(typeof(AbpAspNetCoreMvcUiModule))] + public class AbpAspNetCoreMvcUiBootstrapModule : AbpModule + { + public override void ConfigureServices(IServiceCollection services) + { + services.AddAssemblyOf(); + + services.Configure(options => + { + options.Sources.Add( + new EmbeddedFileSet( + "/Views/", + GetType().GetTypeInfo().Assembly, + "Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Views" + ) + ); + }); + } + } +} diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Properties/launchSettings.json b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Properties/launchSettings.json new file mode 100644 index 0000000000..c2dcf8fae6 --- /dev/null +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:61183/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Volo.Abp.AspNetCore.Mvc.UI.Bootstrap": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} \ No newline at end of file diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/Components/AbpMenu/Default.cshtml b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/Components/AbpMenu/Default.cshtml new file mode 100644 index 0000000000..a53c4fc32d --- /dev/null +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/Components/AbpMenu/Default.cshtml @@ -0,0 +1,22 @@ +@using System.Threading.Tasks +@model Volo.Abp.UI.Navigation.ApplicationMenu +

@Model.DisplayName (BOOTSTRAP)

+ \ No newline at end of file diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.xproj b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.xproj new file mode 100644 index 0000000000..f79b96d762 --- /dev/null +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.xproj @@ -0,0 +1,25 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + c761a3f7-787d-4c7e-a41c-5fab07f6b774 + Volo.Abp.AspNetCore.Mvc.UI.Bootstrap + .\obj + .\bin\ + v4.6.1 + + + + 2.0 + + + + + + + diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/project.json b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/project.json new file mode 100644 index 0000000000..a314a7dee7 --- /dev/null +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/project.json @@ -0,0 +1,22 @@ +{ + "dependencies": { + "Volo.Abp.AspNetCore.Mvc.UI": "1.0.0-*" + }, + + "tools": { + }, + + "frameworks": { + "netstandard1.6": { + "imports": "dnxcore50" + } + }, + + "buildOptions": { + "embed": { + "include": [ + "Views/**/*.*" + ] + } + } +} diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/web.config b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/web.config new file mode 100644 index 0000000000..dc0514fca5 --- /dev/null +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/web.config @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff --git a/src/Volo.Abp/Volo/Abp/Modularity/ModuleLoader.cs b/src/Volo.Abp/Volo/Abp/Modularity/ModuleLoader.cs index 79d34264b1..392153eef4 100644 --- a/src/Volo.Abp/Volo/Abp/Modularity/ModuleLoader.cs +++ b/src/Volo.Abp/Volo/Abp/Modularity/ModuleLoader.cs @@ -22,7 +22,9 @@ namespace Volo.Abp.Modularity FillModules(modules, services, startupModuleType, plugInSources); SetModuleDependencies(modules); - SortByDependency(modules, startupModuleType); + + modules = SortByDependency(modules, startupModuleType); + ConfigureServices(modules, services); return modules.ToArray(); @@ -58,11 +60,12 @@ namespace Volo.Abp.Modularity } } - protected virtual void SortByDependency(List modules, Type startupModuleType) + protected virtual List SortByDependency(List modules, Type startupModuleType) { - modules.SortByDependencies(m => m.Dependencies); - modules.MoveItem(m => m.Type == typeof(AbpKernelModule), 0); - modules.MoveItem(m => m.Type == startupModuleType, modules.Count - 1); + var sortedModules = modules.SortByDependencies(m => m.Dependencies); + sortedModules.MoveItem(m => m.Type == typeof(AbpKernelModule), 0); + sortedModules.MoveItem(m => m.Type == startupModuleType, modules.Count - 1); + return sortedModules; } protected virtual AbpModuleDescriptor CreateModuleDescriptor(IServiceCollection services, Type moduleType)