From d381ef1e5110d1302312aefe79cc0b316faa26ac Mon Sep 17 00:00:00 2001 From: Argo-Tianyi Date: Fri, 7 Jan 2022 12:28:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Client=20=E5=B7=A5?= =?UTF-8?q?=E7=A8=8B=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BootstrapClient.Shared/Shared/MainLayout.razor.cs | 3 ++- .../Extensions/ServicesExtensions.cs | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/blazor/client/BootstrapClient.Shared/Shared/MainLayout.razor.cs b/src/blazor/client/BootstrapClient.Shared/Shared/MainLayout.razor.cs index e73ace1b..6c841128 100644 --- a/src/blazor/client/BootstrapClient.Shared/Shared/MainLayout.razor.cs +++ b/src/blazor/client/BootstrapClient.Shared/Shared/MainLayout.razor.cs @@ -117,10 +117,11 @@ namespace BootstrapClient.Web.Shared.Shared if (!string.IsNullOrEmpty(userName)) { UserName = userName; - DisplayName = UsersService.GetDisplayName(userName); + var user = UsersService.GetUserByUserName(userName); MenuItems = NavigationsService.GetAllMenus(userName).ToClientMenus(); + DisplayName = user?.DisplayName ?? "未注册账户"; Title = DictsService.GetWebTitle(); Footer = DictsService.GetWebFooter(); } diff --git a/src/blazor/client/BootstrapClient.Web/Extensions/ServicesExtensions.cs b/src/blazor/client/BootstrapClient.Web/Extensions/ServicesExtensions.cs index 7c152628..5b2574d9 100644 --- a/src/blazor/client/BootstrapClient.Web/Extensions/ServicesExtensions.cs +++ b/src/blazor/client/BootstrapClient.Web/Extensions/ServicesExtensions.cs @@ -1,4 +1,6 @@ using BootstrapAdmin.Web.Core; +using PetaPoco.Providers; +using PetaPoco; using System.Text; namespace Microsoft.Extensions.DependencyInjection @@ -24,7 +26,13 @@ namespace Microsoft.Extensions.DependencyInjection services.AddBootstrapAdminSecurity(); // 增加 PetaPoco 数据服务 - services.AddPetaPocoDataAccessServices(); + services.AddPetaPocoDataAccessServices((provider, builder) => + { + var configuration = provider.GetRequiredService(); + var connString = configuration.GetConnectionString("bb"); + builder.UsingProvider() + .UsingConnectionString(connString); + }); return services; }