重构代码:移除Bootstrap.Security.SQLServer的引用。更改为DataAccess

This commit is contained in:
Argo-MacBookPro 2018-10-28 23:35:23 +08:00
parent 57efd8d419
commit 45707d7ee8
13 changed files with 32 additions and 31 deletions

View File

@ -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,

View File

@ -17,7 +17,7 @@
},
"DB": [
{
"Enabled": true,
"Enabled": false,
"Widget": "Bootstrap.DataAccess"
},
{

View File

@ -11,7 +11,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Bootstrap.Security.SQLServer" Version="1.0.0" />
<PackageReference Include="Bootstrap.Security.DataAccess" Version="1.0.0" />
<PackageReference Include="Longbow.Cache" Version="1.0.2" />
<PackageReference Include="Longbow.Web" Version="1.0.1" />
</ItemGroup>

View File

@ -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
///
/// </summary>
/// <returns></returns>
private static IEnumerable<BootstrapDict> RetrieveDicts() => CacheManager.GetOrAdd(RetrieveDictsDataKey, key => BASQLHelper.RetrieveDicts());
private static IEnumerable<BootstrapDict> RetrieveDicts() => CacheManager.GetOrAdd(RetrieveDictsDataKey, key => DbHelper.RetrieveDicts());
private static string RetrieveAppName(string name, string defaultValue = "未设置")
{

View File

@ -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<BootstrapMenu> 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;
}
/// <summary>
@ -35,6 +35,6 @@ namespace Bootstrap.Client.DataAccess
/// </summary>
/// <param name="userName"></param>
/// <returns></returns>
private static IEnumerable<BootstrapMenu> RetrieveAllMenus(string userName) => CacheManager.GetOrAdd($"{RetrieveMenusAll}-{userName}", key => BASQLHelper.RetrieveAllMenus(userName), RetrieveMenusAll);
private static IEnumerable<BootstrapMenu> RetrieveAllMenus(string userName) => CacheManager.GetOrAdd($"{RetrieveMenusAll}-{userName}", key => DbHelper.RetrieveAllMenus(userName), RetrieveMenusAll);
}
}

View File

@ -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
/// </summary>
/// <param name="userName"></param>
/// <returns></returns>
public static IEnumerable<string> RetrieveRolesByUserName(string userName) => CacheManager.GetOrAdd(string.Format("{0}-{1}", RetrieveRolesByUserNameDataKey, userName), key => BASQLHelper.RetrieveRolesByUserName(userName), RetrieveRolesByUserNameDataKey);
public static IEnumerable<string> RetrieveRolesByUserName(string userName) => CacheManager.GetOrAdd(string.Format("{0}-{1}", RetrieveRolesByUserNameDataKey, userName), key => DbHelper.RetrieveRolesByUserName(userName), RetrieveRolesByUserNameDataKey);
/// <summary>
///
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
public static IEnumerable<string> RetrieveRolesByUrl(string url) => CacheManager.GetOrAdd(string.Format("{0}-{1}", RetrieveRolesByUrlDataKey, url), key => BASQLHelper.RetrieveRolesByUrl(url), RetrieveRolesByUrlDataKey);
public static IEnumerable<string> RetrieveRolesByUrl(string url) => CacheManager.GetOrAdd(string.Format("{0}-{1}", RetrieveRolesByUrlDataKey, url), key => DbHelper.RetrieveRolesByUrl(url), RetrieveRolesByUrlDataKey);
}
}

View File

@ -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
/// </summary>
/// <param name="userName"></param>
/// <returns></returns>
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);
}
}

View File

@ -11,9 +11,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Bootstrap.Security.SQLServer" Version="1.0.0" />
<PackageReference Include="Bootstrap.Security.DataAccess" Version="1.0.0" />
<PackageReference Include="Longbow.Security.Cryptography" Version="1.0.0" />
<PackageReference Include="Longbow.Web" Version="1.0.1" />
<PackageReference Include="Longbow.Cache" Version="1.0.2" />
</ItemGroup>
</Project>

View File

@ -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
/// </summary>
/// <param name="db">数据库连接实例</param>
/// <returns></returns>
public virtual IEnumerable<BootstrapDict> RetrieveDicts() => BASQLHelper.RetrieveDicts();
public virtual IEnumerable<BootstrapDict> RetrieveDicts() => DbHelper.RetrieveDicts();
}
}

View File

@ -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;
}
/// <summary>
@ -77,9 +77,9 @@ namespace Bootstrap.DataAccess
public static IEnumerable<BootstrapMenu> 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;
}
/// <summary>
@ -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;
}
/// <summary>

View File

@ -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
/// </summary>
/// <param name="userName">当前登陆的用户名</param>
/// <returns></returns>
public virtual IEnumerable<BootstrapMenu> RetrieveAllMenus(string userName) => BASQLHelper.RetrieveAllMenus(userName);
public virtual IEnumerable<BootstrapMenu> RetrieveAllMenus(string userName) => DbHelper.RetrieveAllMenus(userName);
}
}

View File

@ -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
/// </summary>
/// <param name="userName"></param>
/// <returns></returns>
public virtual IEnumerable<string> RetrieveRolesByUserName(string userName) => BASQLHelper.RetrieveRolesByUserName(userName);
public virtual IEnumerable<string> RetrieveRolesByUserName(string userName) => DbHelper.RetrieveRolesByUserName(userName);
/// <summary>
/// 根据菜单url查询某个所拥有的角色
/// 从NavigatorRole表查
/// 从Navigators-〉GroupNavigatorRole-〉Role查查询某个用户所拥有的角色
/// </summary>
/// <returns></returns>
public virtual IEnumerable<string> RetrieveRolesByUrl(string url) => BASQLHelper.RetrieveRolesByUrl(url);
public virtual IEnumerable<string> RetrieveRolesByUrl(string url) => DbHelper.RetrieveRolesByUrl(url);
}
}

View File

@ -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
/// </summary>
/// <param name="userName"></param>
/// <returns></returns>
public virtual BootstrapUser RetrieveUserByUserName(string userName) => BASQLHelper.RetrieveUserByUserName(userName);
public virtual BootstrapUser RetrieveUserByUserName(string userName) => DbHelper.RetrieveUserByUserName(userName);
/// <summary>
///
/// </summary>