From 384be45a5b4f1656449f6afe70b2fbf56a9db95d Mon Sep 17 00:00:00 2001 From: Argo-Surface Date: Sun, 20 Jan 2019 17:10:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=B7=A5=E7=A8=8B=EF=BC=9ABo?= =?UTF-8?q?ostrap.Client=E5=B7=A5=E7=A8=8B=E6=B6=88=E9=99=A4=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bootstrap.Client.DataAccess.csproj | 2 +- Bootstrap.Client.DataAccess/DbAccessManager.cs | 3 ++- Bootstrap.Client.DataAccess/MenuHelper.cs | 7 +++---- Bootstrap.Client/Startup.cs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj b/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj index f4424362..36a904e4 100644 --- a/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj +++ b/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj @@ -11,7 +11,7 @@ - + diff --git a/Bootstrap.Client.DataAccess/DbAccessManager.cs b/Bootstrap.Client.DataAccess/DbAccessManager.cs index 8679cdcc..ad0e73a2 100644 --- a/Bootstrap.Client.DataAccess/DbAccessManager.cs +++ b/Bootstrap.Client.DataAccess/DbAccessManager.cs @@ -1,4 +1,5 @@ using Longbow.Data; +using PetaPoco; namespace Bootstrap.Client.DataAccess { @@ -10,6 +11,6 @@ namespace Bootstrap.Client.DataAccess /// /// /// - public static IDbAccess DbAccess { get { return DbAdapterManager.CreateDB(); } } + public static IDatabase DbAccess { get { return DbManager.Create(); } } } } diff --git a/Bootstrap.Client.DataAccess/MenuHelper.cs b/Bootstrap.Client.DataAccess/MenuHelper.cs index 8af26a5d..ee8ab6f5 100644 --- a/Bootstrap.Client.DataAccess/MenuHelper.cs +++ b/Bootstrap.Client.DataAccess/MenuHelper.cs @@ -22,10 +22,9 @@ namespace Bootstrap.Client.DataAccess /// public static IEnumerable RetrieveAppMenus(string userName, string activeUrl) { - var menus = RetrieveAllMenus(userName).Where(m => m.Category == "1" && m.IsResource == 0 && m.ApplicationCode == ConfigurationManager.AppSettings["AppId"]); - var root = menus.Where(m => m.ParentId == "0").OrderBy(m => m.ApplicationCode).ThenBy(m => m.Order); - DbHelper.CascadeMenus(menus, root); - DbHelper.ActiveMenu(null, menus, activeUrl); + var menus = RetrieveAllMenus(userName).Where(m => m.Category == "1" && m.IsResource == 0 && m.Application == ConfigurationManager.AppSettings["AppId"]).Where(m => m.ParentId == "0").OrderBy(m => m.Application).ThenBy(m => m.Order); + var root = DbHelper.CascadeMenus(menus); + DbHelper.ActiveMenu(root, activeUrl); return root; } diff --git a/Bootstrap.Client/Startup.cs b/Bootstrap.Client/Startup.cs index 670d7cc9..492a5d11 100644 --- a/Bootstrap.Client/Startup.cs +++ b/Bootstrap.Client/Startup.cs @@ -40,7 +40,7 @@ namespace Bootstrap.Client services.AddLogging(builder => builder.AddFileLogger()); services.AddConfigurationManager(Configuration); services.AddCacheManager(Configuration); - services.AddDbAdapter(Configuration); + services.AddDbAdapter(); var dataProtectionBuilder = services.AddDataProtection(op => op.ApplicationDiscriminator = Configuration["ApplicationDiscriminator"]) .SetApplicationName(Configuration["ApplicationName"]) .PersistKeysToFileSystem(new DirectoryInfo(Configuration["KeyPath"])); @@ -60,7 +60,7 @@ namespace Bootstrap.Client services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => { options.Cookie.Path = "/"; - options.RebuildRedirectUri(ConfigurationManager.AppSettings["AuthHost"]); + options.RebuildRedirectUri(); }); }