Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Blazor 如何使用abp.io在ui中显示ExtraProperties_Blazor_Abp - Fatal编程技术网

Blazor 如何使用abp.io在ui中显示ExtraProperties

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

我正在使用abp.io社区版3.3.1与blazor和 我正在尝试为用户添加新属性(identityuserdto),我想将其显示在创建和编辑表单以及数据表中,为此我遵循了此文档

因为找不到文档

这是我的情况 域。共享

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项目),它将是默认页面的自定义实现

从默认页面复制所有内容

之后,确保从默认页面继承

现在根据您的需要编辑代码

由于我在阅读文档时遇到困难,我想解释一下我是如何做到这一点的。 如果您希望自定义租户管理页面,则流程如下:

  • 创建一个类似“MyTenantManagement.razor”的页面

  • 从中获取默认文件内容并将其粘贴到“MyTenantManagement.razor”中

  • 将@inherits行替换为以下内容:

    @继承Volo.Abp.TenantManagement.Blazor.Pages.TenantManagement.TenantManagement

  • 删除@page(以便路由器不会混淆

  • 添加可能缺少的用法(我有这样的用法,所以这可能是必需的步骤)

  • 文件的上半部分可能如下所示:

    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项目上,我们能把它当作一个问题吗?