Blazor 如何使用abp.io在ui中显示ExtraProperties
我正在使用abp.io社区版3.3.1与blazor和 我正在尝试为用户添加新属性(identityuserdto),我想将其显示在创建和编辑表单以及数据表中,为此我遵循了此文档 因为找不到文档 这是我的情况 域。共享Blazor 如何使用abp.io在ui中显示ExtraProperties,blazor,abp,Blazor,Abp,我正在使用abp.io社区版3.3.1与blazor和 我正在尝试为用户添加新属性(identityuserdto),我想将其显示在创建和编辑表单以及数据表中,为此我遵循了此文档 因为找不到文档 这是我的情况 域。共享 namespace University.Situation { public enum SituationType { Student = 1, AssistantProfessor, Professor
namespace University.Situation
{
public enum SituationType
{
Student = 1,
AssistantProfessor,
Professor
}
}
还有我的ModuleExtensionConfigurator
public static void Configure()
{
OneTimeRunner.Run(() =>
{
ObjectExtensionManager.Instance.Modules()
.ConfigureIdentity(identity =>
{
identity.ConfigureUser(user =>
{
user.AddOrUpdateProperty<SituationType>(
"Situation"
);
});
});
});
OneTimeRunner.Run(() =>
{
ConfigureExistingProperties();
ConfigureExtraProperties();
});
publicstaticvoidconfigure()
{
OneTimeRunner.Run(()=>
{
ObjectExtensionManager.Instance.Modules()
.ConfigureIdentity(标识=>
{
identity.ConfigureUser(用户=>
{
user.AddOrUpdateProperty(
“情况”
);
});
});
});
OneTimeRunner.Run(()=>
{
配置现有属性();
ConfigureExtraProperties();
});
当我执行宿主项目时,我可以大摇大摆地看到我的外部属性,但当我执行blazor项目时,我的字段不是
显示在“创建和编辑表单”和“数据表”中
既然我想只有商业版才能自动添加extraproperties,那么我如何手动添加它们呢
提前感谢。如果您查看文档和示例问题(来自我:-|),您将看到您需要从要覆盖的页面或组件继承
一方面,数据库层和域层需要额外的属性。您的问题显示了域层的代码
对于EF Core,您需要自定义在*.EntityFrameworkCore项目中找到的*EfCoreEntityExtensionMappings.cs
现在,对于应用程序和服务,您需要转到*.application.Contracts项目,并将代码添加到*DtoExtensions.cs(该类包含描述如何执行此操作的注释)
最后,创建一个新页面(*.Blazor项目),它将是默认页面的自定义实现
从默认页面复制所有内容
之后,确保从默认页面继承
现在根据您的需要编辑代码
由于我在阅读文档时遇到困难,我想解释一下我是如何做到这一点的。
如果您希望自定义租户管理页面,则流程如下:
Abp.DependencyInjection
@using Microsoft.AspNetCore.Authorization
@using Volo.Abp.FeatureManagement.Blazor.Components
@using Volo.Abp.TenantManagement.Localization
@using Volo.Abp.TenantManagement
@using TT2Masterz.Localization
@using Microsoft.Extensions.Localization
@inherits Volo.Abp.TenantManagement.Blazor.Pages.TenantManagement.TenantManagement
@attribute [Authorize(TenantManagementPermissions.Tenants.Default)]
@attribute [ExposeServices(typeof(Volo.Abp.TenantManagement.Blazor.Pages.TenantManagement.TenantManagement))]
@attribute [Dependency(ReplaceServices = true)]
@inject AbpBlazorMessageLocalizerHelper<AbpTenantManagementResource> LH
@inject IStringLocalizer<TT2MasterzResource> LT
<h2>This is my custom tenant managemant page</h2>
Abp.DependencyInjection
@使用Microsoft.AspNetCore.Authorization
@使用Volo.Abp.FeatureManagement.Blazor.Components
@使用Volo.Abp.TenantManagement.Localization
@使用Volo.Abp.TenantManagement
@使用TT2Masterz.Localization
@使用Microsoft.Extensions.Localization
@继承Volo.Abp.TenantManagement.Blazor.Pages.TenantManagement.TenantManagement
@属性[授权(TenantManagementPermissions.Tenants.Default)]
@属性[公开服务(typeof(Volo.Abp.TenantManagement.Blazor.Pages.TenantManagement.TenantManagement))]
@属性[依赖关系(ReplaceServices=true)]
@注射AbpBlazorMessageLocalizerHelper LH
@注入IStringLocalizer LT
这是我的自定义租户管理页面
<>我希望这能帮助你:我只是尝试了一个基本的ABP项目,使用Rasor UI,它工作,我认为这个问题只在BLAZOR项目上,我们能把它当作一个问题吗?