refactor: 根据最新组件移除Client.DataAccess工程

#Comment
DbHelper增加大量公用静态方法
This commit is contained in:
Argo Zhang 2019-07-01 15:48:54 +08:00
parent c3d455074b
commit 8ce6778bb3
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
13 changed files with 17 additions and 70 deletions

View File

@ -50,6 +50,13 @@
"SlidingExpiration": true, "SlidingExpiration": true,
"Desc": "通过菜单获得角色数据" "Desc": "通过菜单获得角色数据"
}, },
{
"Enabled": true,
"Key": "AppHelper-RetrieveAppsByUserName",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "指定用户授权应用数据缓存"
},
{ {
"Enabled": true, "Enabled": true,
"Key": "BootstrapUser-RetrieveUsersByName", "Key": "BootstrapUser-RetrieveUsersByName",

View File

@ -1,15 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bootstrap.Security.DataAccess" Version="2.2.6" />
<PackageReference Include="Longbow.Cache" Version="2.2.12" />
<PackageReference Include="Longbow.Data" Version="2.3.2" />
<PackageReference Include="Longbow.Web" Version="2.2.14" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.2.4" />
</ItemGroup>
</Project>

View File

@ -1,16 +0,0 @@
using Longbow.Data;
using PetaPoco;
namespace Bootstrap.Client.DataAccess
{
/// <summary>
///
/// </summary>
public static class DbAccessManager
{
/// <summary>
///
/// </summary>
public static IDatabase DbAccess { get { return DbManager.Create(); } }
}
}

View File

@ -1,17 +0,0 @@
using Bootstrap.Security.DataAccess;
using System.Linq;
namespace Bootstrap.Client.DataAccess
{
/// <summary>
///
/// </summary>
public static class DictHelper
{
/// <summary>
/// 获取验证码图床
/// </summary>
/// <returns></returns>
public static string RetrieveImagesLibUrl() => DbHelper.RetrieveDictsWithCache().FirstOrDefault(d => d.Name == "验证码图床" && d.Category == "系统设置" && d.Define == 0)?.Code ?? "http://images.sdgxgz.com/";
}
}

View File

@ -10,11 +10,9 @@
<PackageReference Include="Bootstrap.Security.Mvc" Version="2.2.10" /> <PackageReference Include="Bootstrap.Security.Mvc" Version="2.2.10" />
<PackageReference Include="Longbow.Configuration" Version="2.2.4" /> <PackageReference Include="Longbow.Configuration" Version="2.2.4" />
<PackageReference Include="Longbow.Logging" Version="2.2.8" /> <PackageReference Include="Longbow.Logging" Version="2.2.8" />
<PackageReference Include="Longbow.Web" Version="2.2.14" />
<PackageReference Include="Microsoft.AspNetCore.App" /> <PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup> <PackageReference Include="Microsoft.Data.Sqlite" Version="2.2.4" />
<ItemGroup>
<ProjectReference Include="..\Bootstrap.Client.DataAccess\Bootstrap.Client.DataAccess.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -38,7 +38,7 @@ namespace Bootstrap.Client.Controllers
[AllowAnonymous] [AllowAnonymous]
public IActionResult Error(int id) public IActionResult Error(int id)
{ {
var options = ConfigurationManager.Get<BootstrapAdminOptions>(); var options = ConfigurationManager.Get<BootstrapAdminAuthenticationOptions>();
var uriBuilder = new UriBuilder(options.AuthHost) { Query = QueryString.Create(CookieAuthenticationDefaults.ReturnUrlParameter, $"{Request.Scheme}://{Request.Host}{Request.PathBase}").ToString() }; var uriBuilder = new UriBuilder(options.AuthHost) { Query = QueryString.Create(CookieAuthenticationDefaults.ReturnUrlParameter, $"{Request.Scheme}://{Request.Host}{Request.PathBase}").ToString() };
uriBuilder.Path = uriBuilder.Path == "/" ? Request.Path.Value : uriBuilder.Path + Request.Path.Value; uriBuilder.Path = uriBuilder.Path == "/" ? Request.Path.Value : uriBuilder.Path + Request.Path.Value;
return Redirect(uriBuilder.ToString()); return Redirect(uriBuilder.ToString());

View File

@ -26,7 +26,7 @@ namespace Bootstrap.Client.Models
NotisUrl = DbHelper.RetrieveNotisUrl(); NotisUrl = DbHelper.RetrieveNotisUrl();
// set LogoutUrl // set LogoutUrl
var authHost = ConfigurationManager.Get<BootstrapAdminOptions>().AuthHost; var authHost = ConfigurationManager.Get<BootstrapAdminAuthenticationOptions>().AuthHost;
var uriBuilder = new UriBuilder(authHost); var uriBuilder = new UriBuilder(authHost);
uriBuilder.Path = uriBuilder.Path == "/" ? CookieAuthenticationDefaults.LogoutPath.Value : $"{uriBuilder.Path.TrimEnd('/')}{CookieAuthenticationDefaults.LogoutPath.Value}"; uriBuilder.Path = uriBuilder.Path == "/" ? CookieAuthenticationDefaults.LogoutPath.Value : $"{uriBuilder.Path.TrimEnd('/')}{CookieAuthenticationDefaults.LogoutPath.Value}";
LogoutUrl = uriBuilder.ToString(); LogoutUrl = uriBuilder.ToString();

View File

@ -1,5 +1,4 @@
using Bootstrap.Client.DataAccess; using Bootstrap.Security.DataAccess;
using Bootstrap.Security.DataAccess;
namespace Bootstrap.Client.Models namespace Bootstrap.Client.Models
{ {

View File

@ -1,5 +1,4 @@
using Bootstrap.Client.DataAccess; using Bootstrap.Security;
using Bootstrap.Security;
using Bootstrap.Security.DataAccess; using Bootstrap.Security.DataAccess;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic; using System.Collections.Generic;
@ -18,7 +17,7 @@ namespace Bootstrap.Client.Models
public NavigatorBarModel(ControllerBase controller) : base(controller.User.Identity) public NavigatorBarModel(ControllerBase controller) : base(controller.User.Identity)
{ {
Navigations = DbHelper.RetrieveAppCascadeMenus(UserName, $"~/{controller.ControllerContext.ActionDescriptor.ControllerName}/{controller.ControllerContext.ActionDescriptor.ActionName}"); Navigations = DbHelper.RetrieveAppCascadeMenus(UserName, $"~/{controller.ControllerContext.ActionDescriptor.ControllerName}/{controller.ControllerContext.ActionDescriptor.ActionName}");
ImageLibUrl = DictHelper.RetrieveImagesLibUrl(); ImageLibUrl = DbHelper.RetrieveImagesLibUrl();
} }
/// <summary> /// <summary>

View File

@ -1,5 +1,4 @@
using Bootstrap.Client.DataAccess; using Bootstrap.Security.DataAccess;
using Bootstrap.Security.DataAccess;
using Longbow.Configuration; using Longbow.Configuration;
using Longbow.Web; using Longbow.Web;
using Longbow.Web.SignalR; using Longbow.Web.SignalR;

View File

@ -31,7 +31,7 @@
} }
], ],
"SimulateUserName": "Admin", "SimulateUserName": "Admin",
"BootstrapAdminOptions": { "BootstrapAdminAuthenticationOptions": {
"AuthHost": "http://localhost:50852" "AuthHost": "http://localhost:50852"
}, },
"AllowOrigins": "http://localhost:50852" "AllowOrigins": "http://localhost:50852"

View File

@ -29,7 +29,7 @@
} }
], ],
"AppId": 2, "AppId": 2,
"BootstrapAdminOptions": { "BootstrapAdminAuthenticationOptions": {
"AuthHost": "http://argo.zylweb.cn/BA" "AuthHost": "http://argo.zylweb.cn/BA"
}, },
"AllowOrigins": "http://localhost,http://argo.zylweb.cn", "AllowOrigins": "http://localhost,http://argo.zylweb.cn",

View File

@ -30,8 +30,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bootstrap.Client", "Bootstr
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client", "Client", "{C7F51A14-2D89-4D1F-AD78-C42B79AB0BF0}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client", "Client", "{C7F51A14-2D89-4D1F-AD78-C42B79AB0BF0}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bootstrap.Client.DataAccess", "Bootstrap.Client.DataAccess\Bootstrap.Client.DataAccess.csproj", "{B6B29DE5-D7B0-4A4D-9E7A-AADC68E9C43F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bootstrap.DataAccess", "Bootstrap.DataAccess\Bootstrap.DataAccess.csproj", "{8D62BE79-BE13-43C8-969B-C9B00B3C84B7}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bootstrap.DataAccess", "Bootstrap.DataAccess\Bootstrap.DataAccess.csproj", "{8D62BE79-BE13-43C8-969B-C9B00B3C84B7}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SQLite", "SQLite", "{523515EC-2AD7-4282-9AF4-9D20371183B0}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SQLite", "SQLite", "{523515EC-2AD7-4282-9AF4-9D20371183B0}"
@ -83,10 +81,6 @@ Global
{C82A6E45-AB90-43D1-8429-5CBE953D8151}.Debug|Any CPU.Build.0 = Debug|Any CPU {C82A6E45-AB90-43D1-8429-5CBE953D8151}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C82A6E45-AB90-43D1-8429-5CBE953D8151}.Release|Any CPU.ActiveCfg = Release|Any CPU {C82A6E45-AB90-43D1-8429-5CBE953D8151}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C82A6E45-AB90-43D1-8429-5CBE953D8151}.Release|Any CPU.Build.0 = Release|Any CPU {C82A6E45-AB90-43D1-8429-5CBE953D8151}.Release|Any CPU.Build.0 = Release|Any CPU
{B6B29DE5-D7B0-4A4D-9E7A-AADC68E9C43F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B6B29DE5-D7B0-4A4D-9E7A-AADC68E9C43F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B6B29DE5-D7B0-4A4D-9E7A-AADC68E9C43F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B6B29DE5-D7B0-4A4D-9E7A-AADC68E9C43F}.Release|Any CPU.Build.0 = Release|Any CPU
{8D62BE79-BE13-43C8-969B-C9B00B3C84B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8D62BE79-BE13-43C8-969B-C9B00B3C84B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8D62BE79-BE13-43C8-969B-C9B00B3C84B7}.Debug|Any CPU.Build.0 = Debug|Any CPU {8D62BE79-BE13-43C8-969B-C9B00B3C84B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8D62BE79-BE13-43C8-969B-C9B00B3C84B7}.Release|Any CPU.ActiveCfg = Release|Any CPU {8D62BE79-BE13-43C8-969B-C9B00B3C84B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -106,7 +100,6 @@ Global
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{87319AF5-7C40-4362-B67C-35F9DD737DB4} = {586410F2-C1F0-47CD-AB28-2CF506DED2C8} {87319AF5-7C40-4362-B67C-35F9DD737DB4} = {586410F2-C1F0-47CD-AB28-2CF506DED2C8}
{C82A6E45-AB90-43D1-8429-5CBE953D8151} = {C7F51A14-2D89-4D1F-AD78-C42B79AB0BF0} {C82A6E45-AB90-43D1-8429-5CBE953D8151} = {C7F51A14-2D89-4D1F-AD78-C42B79AB0BF0}
{B6B29DE5-D7B0-4A4D-9E7A-AADC68E9C43F} = {C7F51A14-2D89-4D1F-AD78-C42B79AB0BF0}
{523515EC-2AD7-4282-9AF4-9D20371183B0} = {586410F2-C1F0-47CD-AB28-2CF506DED2C8} {523515EC-2AD7-4282-9AF4-9D20371183B0} = {586410F2-C1F0-47CD-AB28-2CF506DED2C8}
{A06A0AD8-A246-4329-B024-7174AE4A3EDE} = {586410F2-C1F0-47CD-AB28-2CF506DED2C8} {A06A0AD8-A246-4329-B024-7174AE4A3EDE} = {586410F2-C1F0-47CD-AB28-2CF506DED2C8}
{084E2E94-6B7D-4D3E-9BF1-6972427FBF80} = {586410F2-C1F0-47CD-AB28-2CF506DED2C8} {084E2E94-6B7D-4D3E-9BF1-6972427FBF80} = {586410F2-C1F0-47CD-AB28-2CF506DED2C8}