首页 > 解决方案 > Blazor asp.net 核心托管应用程序未将部分类注册到其 razor 组件

问题描述

我试图将我的客户端仅 WASM 转换为托管的 asp.net 核心,但是,我的 component.razor 不再注册它的 component.razor.cs 部分类。

授权剃须刀

    <Warning Display="@_display" Message="@WarningMessage"/>
    @{
        if (Properties == null)
        {
            <p><em>Loading...</em></p>
        }
        else
        {
            foreach (var prop in Properties)
            {
                <InputBox @bind-InputValue="prop.Value" Name="@prop.Name" IsPassword="@prop.IsPassword"/>
            }
        }
    }
    <button type="submit" @onclick="@SubmitButton_Click">Submit</button>
</div>

授权剃须刀.cs

namespace Project.Pages
    }
    public partial class Auth
        {
            private IEnumerable<InputField> Properties { get; set; }
            .
            .
            .
        }
    }

当我在 Rider 中打开项目时,它甚至会堆叠。如果您需要任何想法或向我解释这与创建基类之间的区别

标签: c#asp.netrazorblazorblazor-webassembly

解决方案


命名空间应该是Project.Client.Pages因为服务器部分也包含页面。


推荐阅读