From 45707d7ee8d2f1cfafc6068d65eeb0fcb17e0ea2 Mon Sep 17 00:00:00 2001 From: Argo-MacBookPro Date: Sun, 28 Oct 2018 23:35:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=BB=A3=E7=A0=81=EF=BC=9A?= =?UTF-8?q?=E7=A7=BB=E9=99=A4Bootstrap.Security.SQLServer=E7=9A=84?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E3=80=82=E6=9B=B4=E6=94=B9=E4=B8=BADataAcces?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/appsettings.Development.json | 4 ++-- Bootstrap.Admin/appsettings.json | 2 +- .../Bootstrap.Client.DataAccess.csproj | 2 +- Bootstrap.Client.DataAccess/DictHelper.cs | 4 ++-- Bootstrap.Client.DataAccess/MenuHelper.cs | 8 ++++---- Bootstrap.Client.DataAccess/RoleHelper.cs | 6 +++--- Bootstrap.Client.DataAccess/UserHelper.cs | 4 ++-- Bootstrap.DataAccess/Bootstrap.DataAccess.csproj | 3 ++- Bootstrap.DataAccess/Dict.cs | 4 ++-- Bootstrap.DataAccess/Helper/MenuHelper.cs | 12 ++++++------ Bootstrap.DataAccess/Menu.cs | 4 ++-- Bootstrap.DataAccess/Role.cs | 6 +++--- Bootstrap.DataAccess/User.cs | 4 ++-- 13 files changed, 32 insertions(+), 31 deletions(-) diff --git a/Bootstrap.Admin/appsettings.Development.json b/Bootstrap.Admin/appsettings.Development.json index 5ff31e11..e35d54f0 100644 --- a/Bootstrap.Admin/appsettings.Development.json +++ b/Bootstrap.Admin/appsettings.Development.json @@ -11,13 +11,13 @@ "LogLevel": { "Default": "Error" }, - "FileName": "Error\\Log.log", + "FileName": "Error/Log.log", "MaxFileCount": 1 } }, "SwaggerPathBase": "", "AllowOrigins": "http://localhost:49823", - "KeyPath": "..\\keys", + "KeyPath": "../keys", "DisableAutomaticKeyGeneration": false, "KeepExceptionsPeriod": 1, "KeepLogsPeriod": 1, diff --git a/Bootstrap.Admin/appsettings.json b/Bootstrap.Admin/appsettings.json index 0fea8933..0841530e 100644 --- a/Bootstrap.Admin/appsettings.json +++ b/Bootstrap.Admin/appsettings.json @@ -17,7 +17,7 @@ }, "DB": [ { - "Enabled": true, + "Enabled": false, "Widget": "Bootstrap.DataAccess" }, { diff --git a/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj b/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj index 6d40feb5..5cc3992f 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/DictHelper.cs b/Bootstrap.Client.DataAccess/DictHelper.cs index 5f196621..3af41c50 100644 --- a/Bootstrap.Client.DataAccess/DictHelper.cs +++ b/Bootstrap.Client.DataAccess/DictHelper.cs @@ -1,5 +1,5 @@ using Bootstrap.Security; -using Bootstrap.Security.SQLServer; +using Bootstrap.Security.DataAccess; using Longbow.Cache; using Longbow.Configuration; using System; @@ -56,7 +56,7 @@ namespace Bootstrap.Client.DataAccess /// /// /// - private static IEnumerable RetrieveDicts() => CacheManager.GetOrAdd(RetrieveDictsDataKey, key => BASQLHelper.RetrieveDicts()); + private static IEnumerable RetrieveDicts() => CacheManager.GetOrAdd(RetrieveDictsDataKey, key => DbHelper.RetrieveDicts()); private static string RetrieveAppName(string name, string defaultValue = "未设置") { diff --git a/Bootstrap.Client.DataAccess/MenuHelper.cs b/Bootstrap.Client.DataAccess/MenuHelper.cs index 5e72bbfc..c3958b56 100644 --- a/Bootstrap.Client.DataAccess/MenuHelper.cs +++ b/Bootstrap.Client.DataAccess/MenuHelper.cs @@ -1,5 +1,5 @@ using Bootstrap.Security; -using Bootstrap.Security.SQLServer; +using Bootstrap.Security.DataAccess; using Longbow.Cache; using Longbow.Configuration; using System.Collections.Generic; @@ -25,9 +25,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"]); - BASQLHelper.ActiveMenu(null, menus, activeUrl); + DbHelper.ActiveMenu(null, menus, activeUrl); var root = menus.Where(m => m.ParentId == 0).OrderBy(m => m.ApplicationCode).ThenBy(m => m.Order); - BASQLHelper.CascadeMenus(menus, root); + DbHelper.CascadeMenus(menus, root); return root; } /// @@ -35,6 +35,6 @@ namespace Bootstrap.Client.DataAccess /// /// /// - private static IEnumerable RetrieveAllMenus(string userName) => CacheManager.GetOrAdd($"{RetrieveMenusAll}-{userName}", key => BASQLHelper.RetrieveAllMenus(userName), RetrieveMenusAll); + private static IEnumerable RetrieveAllMenus(string userName) => CacheManager.GetOrAdd($"{RetrieveMenusAll}-{userName}", key => DbHelper.RetrieveAllMenus(userName), RetrieveMenusAll); } } diff --git a/Bootstrap.Client.DataAccess/RoleHelper.cs b/Bootstrap.Client.DataAccess/RoleHelper.cs index b88ff2fe..1284d0c2 100644 --- a/Bootstrap.Client.DataAccess/RoleHelper.cs +++ b/Bootstrap.Client.DataAccess/RoleHelper.cs @@ -1,4 +1,4 @@ -using Bootstrap.Security.SQLServer; +using Bootstrap.Security.DataAccess; using Longbow.Cache; using System.Collections.Generic; @@ -16,12 +16,12 @@ namespace Bootstrap.Client.DataAccess /// /// /// - public static IEnumerable RetrieveRolesByUserName(string userName) => CacheManager.GetOrAdd(string.Format("{0}-{1}", RetrieveRolesByUserNameDataKey, userName), key => BASQLHelper.RetrieveRolesByUserName(userName), RetrieveRolesByUserNameDataKey); + public static IEnumerable RetrieveRolesByUserName(string userName) => CacheManager.GetOrAdd(string.Format("{0}-{1}", RetrieveRolesByUserNameDataKey, userName), key => DbHelper.RetrieveRolesByUserName(userName), RetrieveRolesByUserNameDataKey); /// /// /// /// /// - public static IEnumerable RetrieveRolesByUrl(string url) => CacheManager.GetOrAdd(string.Format("{0}-{1}", RetrieveRolesByUrlDataKey, url), key => BASQLHelper.RetrieveRolesByUrl(url), RetrieveRolesByUrlDataKey); + public static IEnumerable RetrieveRolesByUrl(string url) => CacheManager.GetOrAdd(string.Format("{0}-{1}", RetrieveRolesByUrlDataKey, url), key => DbHelper.RetrieveRolesByUrl(url), RetrieveRolesByUrlDataKey); } } \ No newline at end of file diff --git a/Bootstrap.Client.DataAccess/UserHelper.cs b/Bootstrap.Client.DataAccess/UserHelper.cs index 3d896dd2..f4c2c1e9 100644 --- a/Bootstrap.Client.DataAccess/UserHelper.cs +++ b/Bootstrap.Client.DataAccess/UserHelper.cs @@ -1,5 +1,5 @@ using Bootstrap.Security; -using Bootstrap.Security.SQLServer; +using Bootstrap.Security.DataAccess; using Longbow.Cache; namespace Bootstrap.Client.DataAccess @@ -15,6 +15,6 @@ namespace Bootstrap.Client.DataAccess /// /// /// - public static BootstrapUser RetrieveUserByUserName(string userName) => CacheManager.GetOrAdd(string.Format("{0}-{1}", RetrieveUsersByNameDataKey, userName), k => BASQLHelper.RetrieveUserByUserName(userName), RetrieveUsersByNameDataKey); + public static BootstrapUser RetrieveUserByUserName(string userName) => CacheManager.GetOrAdd(string.Format("{0}-{1}", RetrieveUsersByNameDataKey, userName), k => DbHelper.RetrieveUserByUserName(userName), RetrieveUsersByNameDataKey); } } diff --git a/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj b/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj index d1a6342d..e1c234ff 100644 --- a/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj +++ b/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj @@ -11,9 +11,10 @@ - + + diff --git a/Bootstrap.DataAccess/Dict.cs b/Bootstrap.DataAccess/Dict.cs index 3fcdf758..400a96ff 100644 --- a/Bootstrap.DataAccess/Dict.cs +++ b/Bootstrap.DataAccess/Dict.cs @@ -1,5 +1,5 @@ using Bootstrap.Security; -using Bootstrap.Security.SQLServer; +using Bootstrap.Security.DataAccess; using System; using System.Collections.Generic; using System.Data; @@ -164,6 +164,6 @@ namespace Bootstrap.DataAccess /// /// 数据库连接实例 /// - public virtual IEnumerable RetrieveDicts() => BASQLHelper.RetrieveDicts(); + public virtual IEnumerable RetrieveDicts() => DbHelper.RetrieveDicts(); } } diff --git a/Bootstrap.DataAccess/Helper/MenuHelper.cs b/Bootstrap.DataAccess/Helper/MenuHelper.cs index cec4f37c..0b233fc6 100644 --- a/Bootstrap.DataAccess/Helper/MenuHelper.cs +++ b/Bootstrap.DataAccess/Helper/MenuHelper.cs @@ -1,5 +1,5 @@ using Bootstrap.Security; -using Bootstrap.Security.SQLServer; +using Bootstrap.Security.DataAccess; using Longbow.Cache; using Longbow.Data; using System.Collections.Generic; @@ -61,9 +61,9 @@ namespace Bootstrap.DataAccess { var menus = RetrieveAllMenus(userName).Where(m => m.Category == "1" && m.IsResource == 0); if (appId != "0") menus = menus.Where(m => m.ApplicationCode == appId); - BASQLHelper.ActiveMenu(null, menus, activeUrl); + DbHelper.ActiveMenu(null, menus, activeUrl); var root = menus.Where(m => m.ParentId == 0).OrderBy(m => m.ApplicationCode).ThenBy(m => m.Order); - BASQLHelper.CascadeMenus(menus, root); + DbHelper.CascadeMenus(menus, root); return root; } /// @@ -77,9 +77,9 @@ namespace Bootstrap.DataAccess public static IEnumerable RetrieveSystemMenus(string userName, string activeUrl = null) { var menus = RetrieveAllMenus(userName).Where(m => m.Category == "0" && m.IsResource == 0); - BASQLHelper.ActiveMenu(null, menus, activeUrl); + DbHelper.ActiveMenu(null, menus, activeUrl); var root = menus.Where(m => m.ParentId == 0).OrderBy(m => m.ApplicationCode).ThenBy(m => m.Order); - BASQLHelper.CascadeMenus(menus, root); + DbHelper.CascadeMenus(menus, root); return root; } /// @@ -91,7 +91,7 @@ namespace Bootstrap.DataAccess { var menus = RetrieveAllMenus(userName); var root = menus.Where(m => m.ParentId == 0).OrderBy(m => m.ApplicationCode).ThenBy(m => m.Order); - BASQLHelper.CascadeMenus(menus, root); + DbHelper.CascadeMenus(menus, root); return root; } /// diff --git a/Bootstrap.DataAccess/Menu.cs b/Bootstrap.DataAccess/Menu.cs index d0aaf3b6..00e656b3 100644 --- a/Bootstrap.DataAccess/Menu.cs +++ b/Bootstrap.DataAccess/Menu.cs @@ -1,5 +1,5 @@ using Bootstrap.Security; -using Bootstrap.Security.SQLServer; +using Bootstrap.Security.DataAccess; using Longbow; using Longbow.Data; using System; @@ -137,6 +137,6 @@ namespace Bootstrap.DataAccess /// /// 当前登陆的用户名 /// - public virtual IEnumerable RetrieveAllMenus(string userName) => BASQLHelper.RetrieveAllMenus(userName); + public virtual IEnumerable RetrieveAllMenus(string userName) => DbHelper.RetrieveAllMenus(userName); } } diff --git a/Bootstrap.DataAccess/Role.cs b/Bootstrap.DataAccess/Role.cs index 3cd0c15d..4a06353a 100644 --- a/Bootstrap.DataAccess/Role.cs +++ b/Bootstrap.DataAccess/Role.cs @@ -1,4 +1,4 @@ -using Bootstrap.Security.SQLServer; +using Bootstrap.Security.DataAccess; using Longbow; using Longbow.Data; using System; @@ -315,13 +315,13 @@ namespace Bootstrap.DataAccess /// /// /// - public virtual IEnumerable RetrieveRolesByUserName(string userName) => BASQLHelper.RetrieveRolesByUserName(userName); + public virtual IEnumerable RetrieveRolesByUserName(string userName) => DbHelper.RetrieveRolesByUserName(userName); /// /// 根据菜单url查询某个所拥有的角色 /// 从NavigatorRole表查 /// 从Navigators-〉GroupNavigatorRole-〉Role查查询某个用户所拥有的角色 /// /// - public virtual IEnumerable RetrieveRolesByUrl(string url) => BASQLHelper.RetrieveRolesByUrl(url); + public virtual IEnumerable RetrieveRolesByUrl(string url) => DbHelper.RetrieveRolesByUrl(url); } } diff --git a/Bootstrap.DataAccess/User.cs b/Bootstrap.DataAccess/User.cs index af3e82c7..e892793e 100644 --- a/Bootstrap.DataAccess/User.cs +++ b/Bootstrap.DataAccess/User.cs @@ -1,5 +1,5 @@ using Bootstrap.Security; -using Bootstrap.Security.SQLServer; +using Bootstrap.Security.DataAccess; using Longbow; using Longbow.Data; using Longbow.Security.Cryptography; @@ -471,7 +471,7 @@ namespace Bootstrap.DataAccess /// /// /// - public virtual BootstrapUser RetrieveUserByUserName(string userName) => BASQLHelper.RetrieveUserByUserName(userName); + public virtual BootstrapUser RetrieveUserByUserName(string userName) => DbHelper.RetrieveUserByUserName(userName); /// /// ///